Example #1
0
 public function __construct(array $attributes = [])
 {
     $this->fillable = array_merge($this->fillable, ['parent_id']);
     $this->aliases = array_merge($this->aliases, ['parent_id' => 'Parent']);
     $this->prefixSlug = getSlug('staticpage');
     parent::__construct($attributes);
 }
function renameFile($filename)
{
    $text = file_get_contents($filename);
    $slug = getSlug($text);
    if ($slug) {
        var_dump($slug);
        rename($filename, $slug . '.md');
    }
}
Example #3
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Auth::guard($guard)->check()) {
         $user = Auth::guard($guard)->user();
         $site = $user->site ?: site();
         $root = $site->getRootUrl();
         $userSlug = getSlug('userhome');
         $url = $root . '/' . $userSlug;
         return redirect()->away($url);
     }
     return $next($request);
 }
Example #4
0
 /**
  * Create a new controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->middleware('guest');
     $userSlug = getSlug('userhome');
     $this->redirectTo = $userSlug;
 }
 private function listaSlug($value = 'disciplinas', $param = null)
 {
     $objetos = '';
     switch ($value) {
         case 'aulas':
             $model = $this->aulas_model;
             break;
         case 'disciplinas':
             $model = $this->disciplinas_model;
             break;
     }
     foreach ($model->listar($param) as $objeto) {
         $objeto->slug = getSlug($objeto->nome);
         $objetos[] = $objeto;
     }
     return $objetos;
 }
Example #6
0
function showpageslist()
{
    ?>
<h2>Sidebar Pages</h2>
<?php 
    global $WebPagesList, $settings;
    $p = $WebPagesList;
    $p = msort($p);
    echo "<table border=1 cellpadding=5>";
    echo "<tr><th>Page</th><th>Options</th><th colspan=2>Move</th><th>URL you can use</th></tr>";
    foreach ($p as $pg) {
        if (inSidebar($pg)) {
            $s = "<tr>\r\n\t\t\t\t\t<td><b>" . getTitle($pg) . "</b></td>\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<a href='?action=edit&slug=" . getSlug($pg) . "'>Edit</a> | \r\n\t\t\t\t\t\t<a href='?action=delete&slug=" . getSlug($pg) . "' onclick='return confirm(\"Are you sure you want to delete this page!! Remember Once you delete you cannot retreive again!! Proceed???\");'>Delete</a>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td><a href='?action=moveup&slug=" . getSlug($pg) . "'>UP</a></td>\r\n\t\t\t\t\t<td><a href='?action=movedown&slug=" . getSlug($pg) . "'>Down</a></td>\r\n\t\t\t\t\t<td><a href='" . NANO_CMS_PAGE . "?slug=" . getSlug($pg) . "'>" . NANO_CMS_PAGE . "?slug=" . getSlug($pg) . "</a></td>\r\n\t\t\t\t  </tr>";
            echo $s;
        }
    }
    echo "</table>";
    ?>
</td><td>
<h2>Saperate Pages</h2>
<?php 
    global $WebPagesList, $settings;
    $p = $WebPagesList;
    $p = msort($p);
    echo "<table border=1 cellpadding=5>";
    echo "<tr class=th><th>Page</th><th>Edit</th><th>URL you can use</th></tr>";
    foreach ($p as $pg) {
        if (!inSidebar($pg)) {
            $s = "<tr>\r\n\t\t\t\t\t<td><b>" . getTitle($pg) . "</b></td>\r\n\t\t\t\t\t<td>\r\n\t\t\t\t\t\t<a href='?action=edit&slug=" . getSlug($pg) . "'>Edit</a> | \r\n\t\t\t\t\t\t<a href='?action=delete&slug=" . getSlug($pg) . "' onclick='return confirm(\"Are you sure you want to delete this page!! Remember Once you delete you cannot retreive again!! Proceed???\");'>Delete</a>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td><a href='" . NANO_CMS_PAGE . "?slug=" . getSlug($pg) . "'>" . NANO_CMS_PAGE . "?slug=" . getSlug($pg) . "</a></td>\r\n\t\t\t\t  </tr>";
            echo $s;
        }
    }
    echo "</table>";
}
Example #7
0
    }]);
    $router->resource('profile', 'ProfileController');
    $router->resource(getSlug('article'), 'ArticleController');
});
// ADMIN AREA
$router->group(['prefix' => $adminSlug, 'as' => $adminSlug . '.', 'namespace' => 'Backend', 'middleware' => 'auth'], function ($router) {
    $router->get('/', ['as' => 'admin.home', function () {
        return view('livecms::admin.home');
    }]);
    $router->resource(getSlug('category'), 'CategoryController');
    $router->resource(getSlug('tag'), 'TagController');
    $router->put(getSlug('article') . '/{id}/update-featured', 'ArticleController@putUpdateFeatured');
    $router->resource(getSlug('article'), 'ArticleController');
    $router->resource(getSlug('staticpage'), 'StaticPageController');
    $router->resource(getSlug('team'), 'TeamController');
    $router->resource(getSlug('project'), 'ProjectController');
    $router->resource(getSlug('projectcategory'), 'ProjectCategoryController');
    $router->resource(getSlug('client'), 'ClientController');
    $router->resource(getSlug('gallery'), 'GalleryController');
    $router->resource(getSlug('contact'), 'ContactController');
    $router->resource('permalink', 'PermalinkController');
    $router->resource('setting', 'SettingController');
    $router->resource('user', 'UserController');
    $router->resource('site', 'SiteController');
});
// AUTH
Auth::routes();
$router->get('logout', 'Auth\\LoginController@logout');
$router->get('register', function () {
    return redirect()->route('user.home');
});
Example #8
0
 function liveCMSRouter($router, callable $callback)
 {
     $adminSlug = getSlug('admin');
     $site = site()->getCurrent();
     $subDomain = $site->subdomain;
     $subFolder = $site->subfolder;
     // ROUTING
     $router->group(['middleware' => 'web', 'prefix' => $subFolder], function ($router) use($adminSlug, $subDomain, $subFolder, $callback) {
         $callback($router, $adminSlug, $subDomain, $subFolder);
     });
 }
Example #9
0
function menu()
{
    global $c, $host;
    $mlist = explode("<br />\n", $c['menu']);
    ?>
<ul>
	<?php 
    foreach ($mlist as $cp) {
        ?>
			<li<?php 
        if ($c['page'] == getSlug($cp)) {
            echo ' id="active" ';
        }
        ?>
><a href='<?php 
        echo getSlug($cp);
        ?>
'><?php 
        echo $cp;
        ?>
</a></li>
	<?php 
    }
    ?>
	</ul>
<?php 
}
Example #10
0
$user_id = $_SESSION['user_id'];
$campaign_id = $_SESSION['campaigns_id'];
$banner = 'banner-1';
function getSlug($text)
{
    $text = preg_replace('~[^\\pL\\d]+~u', '-', $text);
    $text = trim($text, '-');
    $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
    $text = strtolower($text);
    $text = preg_replace('~[^-\\w]+~', '', $text);
    if (empty($text)) {
        return 'n-a';
    }
    return $text;
}
$slug = getSlug($campaignname);
//  short link function starts here //
function make_bitly_url($url, $login, $appkey, $format = 'xml', $version = '2.0.1')
{
    //create the URL
    $bitly = 'http://api.bit.ly/shorten?version=' . $version . '&longUrl=' . urlencode($url) . '&login='******'&apiKey=' . $appkey . '&format=' . $format;
    //get the url
    //could also use cURL here
    $response = file_get_contents($bitly);
    //parse depending on desired format
    if (strtolower($format) == 'json') {
        $json = @json_decode($response, true);
        return $json['results'][$url]['shortUrl'];
    } else {
        $xml = simplexml_load_string($response);
        return 'http://bit.ly/' . $xml->results->nodeKeyVal->hash;
Example #11
0
function set_curr_page()
{
    global $WebPagesList, $CurrentActivePage;
    if (isset($_GET[slug])) {
        $slug = $_GET[slug];
        foreach ($WebPagesList as $pg) {
            if (getSlug($pg) == $slug) {
                $CurrentActivePage = $pg;
                break;
            }
        }
    } else {
        $slug = getSlug($WebPagesList[0]);
        $CurrentActivePage = $WebPagesList[0];
    }
}
Example #12
0
 function getArticleTags($article)
 {
     return dataImplode($article->tags, 'tag', function ($tag, $slug) {
         return '<a style="color: black" href="' . url(getSlug('tag') . '/' . $slug) . '">' . $tag . '</a>';
     }, 'slug');
 }
Example #13
0
function getTrends($index, $section)
{
    global $host;
    global $apiKey;
    global $all_sections;
    //
    $request = "http://api.chartbeat.com/live/toppages/v3/?apikey={$apiKey}&host={$host}&section={$section}&limit=100";
    //
    $response = Unirest\Request::get($request, array("Accept" => "application/json"));
    //
    $json = $response->raw_body;
    //
    $arr = json_decode($json);
    //
    $data = $arr->pages;
    //echo var_dump($data);
    foreach ($data as $key => $value) {
        if ($value->authors != NULL) {
            //
            array_push($all_sections[$index], getSlug($value->path));
        }
    }
}
Example #14
0
function menu($stags, $etags)
{
    global $c, $hostname;
    $mlist = explode('<br>', $c['menu']);
    for ($i = 0; $i < count($mlist); $i++) {
        $page = getSlug($mlist[$i]);
        if (!$page) {
            continue;
        }
        echo $stags . " href='" . $hostname . $page . "'>" . str_replace('-', ' ', $page) . " " . $etags . " \n";
    }
}
Example #15
0
 /**
  * Create a new authentication controller instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this->middleware('guest', ['except' => 'logout']);
     $userSlug = getSlug('userhome');
     $this->redirectTo = $userSlug;
 }
Example #16
0
 public function routes()
 {
     $parameters = func_get_args();
     // get static
     $statisSlug = getSlug('staticpage');
     $param = isset($parameters[1]) ? $parameters[1] : null;
     if ($parameters[0] == $statisSlug) {
         view()->share('routeBy', 'static');
         return $this->getStaticPage(true, $parameters[1]);
     }
     // get article category
     $categorySlug = getSlug('category');
     $category = Category::where('slug', $param)->first();
     if ($category && $parameters[0] == $categorySlug) {
         view()->share('routeBy', 'category');
         view()->share('category', $category);
         view()->share('title', $category->category);
         return $this->getArticle(true, null, $category ? ['categories' => $category->id] : []);
     }
     // get article tag
     $tagSlug = getSlug('tag');
     $tag = Tag::where('slug', $param)->first();
     if ($tag && $parameters[0] == $tagSlug) {
         view()->share('routeBy', 'tag');
         view()->share('tag', $tag);
         view()->share('title', $tag->tag);
         return $this->getArticle(true, null, $tag ? ['tags' => $tag->id] : []);
     }
     // get article
     $articleSlug = getSlug('article');
     if ($parameters[0] == $articleSlug) {
         view()->share('routeBy', 'article');
         return $this->getArticle(true, $param);
     }
     // get gallery
     $gallerySlug = getSlug('gallery');
     if ($parameters[0] == $gallerySlug) {
         view()->share('routeBy', 'gallery');
         return $this->getGallery(true, $param);
     }
     $permalink = implode('/', $parameters);
     return $this->getByPermalink($permalink);
 }
Example #17
0
function getBroadcasterServiceSlug($name)
{
    $base = '/services/';
    return $base . getSlug($name);
}
Example #18
0
<?php

$adminSlug = getSlug('admin');
$menus = config('livecms.menus.admin');
?>

<!-- Home -->
<li class="@if(isInCurrentRoute('admin.home'))active @endif"><a href="{{ route($adminSlug.'.'.'admin.home') }}"><i class="fa fa-dashboard"></i> <span>Dashboard</span></a></li>

{!! getMenus($adminSlug, $menus) !!}
Example #19
0
        $rtnCreatorType = getCreatorType($row["creator_type"]);
        $xml .= '<item>
		<title>' . $row["title"] . '</title>
		<link>http://tsutomuishida.co.uk/kaiseisha/book/' . getSlug($row["title"]) . '/</link>
		<pubDate>Fri, 06 Nov 2015 20:42:03 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
		<guid isPermaLink="false"></guid>
		<description></description>
		<content:encoded><![CDATA[' . $row["synopsis"] . ']]></content:encoded>
		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
		<wp:post_id></wp:post_id>
		<wp:post_date>2015-11-06 20:42:03</wp:post_date>
		<wp:post_date_gmt>2015-11-06 20:42:03</wp:post_date_gmt>
		<wp:comment_status>closed</wp:comment_status>
		<wp:ping_status>closed</wp:ping_status>
		<wp:post_name>' . getSlug($row["title"]) . '</wp:post_name>
		<wp:status>publish</wp:status>
		<wp:post_parent>0</wp:post_parent>
		<wp:menu_order>0</wp:menu_order>
		<wp:post_type>book</wp:post_type>
		<wp:post_password></wp:post_password>
		<wp:is_sticky>0</wp:is_sticky>
		<wp:postmeta>
			<wp:meta_key>_edit_last</wp:meta_key>
			<wp:meta_value><![CDATA[1]]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
			<wp:meta_key>age_groups</wp:meta_key>
			<wp:meta_value><![CDATA[AG' . $row["age_group_id"] . ']]></wp:meta_value>
		</wp:postmeta>
		<wp:postmeta>
Example #20
0
 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
     $this->prefixSlug = getSlug('team');
 }
/**
 * 
 * @param type $author
 * @param type $bio - 'short' = short bio
 * @param type $avatar - 0 = no avatar
 * @return string Content with shortcodes filtered out
 */
function get_author_markup($author, $bio = 'true', $avatar = '', $linkType = '')
{
    //KC::debug("!!");
    //KC::debug(esc_attr(get_option('kc_default_image')));
    //global $post;
    $author_slug = KC::$author_slug;
    $code = '';
    $author_id = $author->ID;
    $display_name = $author->display_name;
    $display_name_slug = getSlug($display_name);
    //$author_link       = get_permalink(get_page_by_path('about-us')->ID) . '#' . $display_name_slug;
    $author_link = site_url(KC::$author_slug . '/#' . $display_name_slug);
    $job = esc_attr($author->job_title);
    // (get_the_author_meta('job-title', $author_id));
    //$twitter = $author->twitter; // get_user_meta($author->ID, 'twitter', true);
    //$facebook = $author->facebook;
    //do_shortcode("[button link='$posts_url'] $posts_link_text [/button]"); //("[button link='$posts_url']$posts_link_text[/button]");
    //admin_label = "Person" facebook_url = ""
    if ($avatar == "0") {
        $avatar = '';
    } elseif (!$avatar) {
        $avatar = get_author_avatar_url($author_id);
    }
    $bioContent = '';
    if ($bio) {
        if ($bio === "short") {
            $bioContent = wpautop($author->wp_biographia_short_bio);
        } elseif ($bio === "true") {
            $bioContent = wpautop($author->description ? $author->description : $author->wp_biographia_short_bio);
        } else {
            $bioContent = $bio;
        }
    }
    $posts_url = get_author_posts_url($author_id);
    $readPostsContent = count_user_posts($author_id) == 0 ? '' : '' . '<div class="read-author-posts">' . '<a href="' . $posts_url . '" class="et_pb_more_button et_pb_button et_pb_button_one">' . 'Read posts' . '</a>' . '</div>';
    $code .= <<<EOT
        <article class="et_pb_post status-publish format-standard hentry et_pb_module et_pb_toggle  et_pb_toggle_2 et_pb_toggle_item et_pb_toggle_open">
            
            [et_pb_team_member name = "{$display_name}" position = "{$job}" image_url = "{$avatar}" animation 
            module_id="{$display_name_slug}" module_class="author" background_layout = "light" use_border_color = "off" border_color = "" border_style]

                [et_pb_toggle admin_label="Toggle" title="" open="off" use_border_color="off"]

                    <div class="bio_content">
                    {$bioContent}
                    </div>
                    {$readPostsContent}
            
                [/et_pb_toggle] 
            
            [/et_pb_team_member]
            
            <script>
            jQuery( document ).ready(function( \$ ) {
                \$("#{$display_name_slug} h4").wrap("<a href=\\"{$author_link}\\"></a>");
            });
            </script>

        </article>
EOT;
    return do_shortcode($code);
}