/**
  * @param Application $app
  */
 protected function setDefaultPermalinkStructure(Application $app)
 {
     actions()->listen('wp_install', function () use($app) {
         $app['wp_rewrite']->set_permalink_structure('/%postname%/');
         $app['wp_rewrite']->flush_rules(true);
     });
 }
function execute_action($action)
{
    $myaction = actions($action);
    if (is_array($myaction)) {
        extract($myaction);
        return call_user_func_array($callback, get_fields_ordered_numeric($_REQUEST, $c_vars));
    }
    return FALSE;
}
 public function register()
 {
     parent::register();
     /** @var Factory $view */
     $view = $this->app['view'];
     $this->registerViewComposer($view);
     actions()->listen('wp', function () use($view) {
         if (app()->isShared('post')) {
             /** @var Post $post */
             $view->share('__post', $post = app('post'));
             if ($post instanceof Page) {
                 $view->share(['__template' => $post->getMeta('template'), '__sidebar' => $post->getMeta('sidebar')]);
             }
         }
     });
 }
 public function register()
 {
     parent::register();
     /** @var Factory $view */
     $view = $this->app['view'];
     actions()->listen('wp', function () use($view) {
         if (app()->isShared('post')) {
             /** @var Post $post */
             $view->share('__post', $post = app('post'));
             if ($post instanceof Page) {
                 $view->share(['__template' => $post->getMeta('template'), '__sidebar' => $post->getMeta('sidebar')]);
             }
         }
     });
     filters()->listen('wp_title_parts', function ($titleParts) {
         return is_404() ? [trans('page-titles.' . $this->app['router']->currentRouteName())] : $titleParts;
     });
 }
Esempio n. 5
0
/**
 * @brief display resource ebook subsection
 * @global type $id
 * @global type $urlServer
 * @global type $is_editor
 * @global type $langWasDeleted
 * @global type $course_code 
 * @global type $langInactiveModule
 * @param type $title
 * @param type $comments
 * @param type $resource_id
 * @param type $ebook_id
 * @param type $display_id
 * @param type $visibility
 * @param type $deleted
 * @return string
 */
function show_ebook_resource($title, $comments, $resource_id, $ebook_id, $display_id, $visibility, $deleted)
{
    global $id, $urlServer, $is_editor, $langWasDeleted, $course_code, $themeimg, $langInactiveModule;
    $module_visible = visible_module(MODULE_ID_EBOOK);
    // checks module visibility
    if (!$module_visible and !$is_editor) {
        return '';
    }
    $comment_box = $class_vis = $imagelink = $link = '';
    $class_vis = ($visibility == 0 or !$module_visible) ? ' class="not_visible"' : ' ';
    if ($deleted) {
        if (!$is_editor) {
            return '';
        } else {
            $status = 'del';
            $imagelink = icon('fa-times');
            $exlink = "<span class='not_visible'>{$title} ({$langWasDeleted})</span>";
        }
    } else {
        $link = "<a href='{$urlServer}modules/ebook/show.php/{$course_code}/{$ebook_id}/{$display_id}/unit={$id}'>";
        $exlink = $link . q($title) . '</a>';
        if (!$module_visible) {
            $exlink .= " <i>({$langInactiveModule})</i>";
        }
        $imagelink = $link . "" . icon('fa-book') . "</a>";
    }
    if (!empty($comments)) {
        $comment_box = "<br />{$comments}";
    } else {
        $comment_box = "";
    }
    return "\n        <tr{$class_vis}>\n          <td width='3'>{$imagelink}</td>\n          <td>{$exlink} {$comment_box}</td>" . actions('section', $resource_id, $visibility) . "\n        </tr>";
}
Esempio n. 6
0
<?php

require_once dirname(__DIR__) . "/mvc/Factory.php";
$factory = new MP_Factory();
require_once $factory->find_wp_load();
actions($_GET['action']);
function actions($action)
{
    $factory = new MP_Factory();
    $myDB = $factory->myDB();
    $myDB->connect_db(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    switch ($action) {
        case 'login':
            $user = $myDB->print_all_items_from_tables('MP_user', 'id,MP_email,MP_password', 'MP_email', $_POST['MP_email']);
            $encrypt = md5($_POST['MP_password']);
            if ($user[1]['MP_password'] == $encrypt) {
                $token = $user[1]['id'] . "-" . $encrypt;
                $domain = $_SERVER['HTTP_HOST'] != 'localhost' ? $_SERVER['HTTP_HOST'] : false;
                setcookie('MP_user', $token, 0, '/', $domain, false);
                header('location:' . $_SERVER['HTTP_REFERER']);
            }
            break;
        case 'register':
            $_POST['MP_password'] = md5($_POST['MP_password']);
            $encrypt = $_POST['MP_password'];
            $update = $myDB->add_post_to_db($_POST, 'MP_user');
            if ($update != false) {
                $domain = $_SERVER['HTTP_HOST'] != 'localhost' ? $_SERVER['HTTP_HOST'] : false;
                setcookie('MP_user', $token, 0, '/', $domain, false);
                header('location:' . $_SERVER['HTTP_REFERER']);
            } else {
Esempio n. 7
0
     $img = "generic18.gif";
 }
 echo "<tr bgcolor=\"{$col}\" >\n <td valign=middle width=10>";
 if ($isaudio) {
     echo "<a href=\"{$avsswwwdir}/cgi-bin/avssmain.m3u?playpathfile=1" . "&amp;sess={$sess}&amp;path=" . htmlentities($wwwpath . "/" . $allfiles["fname"][$j]) . "\">";
 } else {
     echo "<a href=\"?sess={$sess}&amp;path=" . urlencode($path) . "&mp3file=" . urlencode($allfiles["fname"][$j]) . "\">";
 }
 echo "<img border=0 src='{$avsswwwdir}/images/{$img}'></a></td>\n";
 echo "  <td width='20%'><input  class='itxt' readonly style='background-color:{$col}' type=text name=\"orgfile[]\" " . " onmouseover=\"return overlib('{$ID3s[$j]}',RELX,-4,RELY,4,WIDTH,500)\" " . " onmouseout=\"return nd();\"" . " value=\"" . $allfiles["fname"][$j] . "\"></td>\n";
 echo "  <td width='20%'><input  class='itxt' style='background-color:{$col}' type=text id=newf" . ($j - $nd) . " name=\"newfile[]\" " . " onmouseover=\"return overlib('{$ID3s[$j]}',RELX,-4,RELY,4,WIDTH,500)\" " . " onmouseout=\"return nd();\"" . " value=\"";
 if ($isaudio) {
     $af++;
     //audiofiles
     $newfile = clean1($allfiles["fname"][$j]);
     $newfile = actions($newfile, $j - $nd, $af);
 } else {
     $newfile = $allfiles["fname"][$j];
 }
 echo "{$newfile}\"></td>\n";
 $duration = $allfiles["mins"][$j] . ":" . $allfiles["secs"][$j];
 echo "  <td valign=middle align=right>";
 if ($isaudio) {
     $x = $j - $nd;
     if (!isset($TAGS[$j]['TPE1'])) {
         $TAGS[$j]['TPE1'] = "";
     }
     //do not complain for undefined
     if (!isset($TAGS[$j]['Artist'])) {
         $TAGS[$j]['Artist'] = "";
     }
Esempio n. 8
0
<?php

/**
 * Actions Framework.
 *
 * WARNING: This file is part of the core Actions Framework. DO NOT edit this file under any circumstances.
 * Please do all modifications in the form of a child theme.
 *
 * @package Actions 
 * @author  WPDevHQ
 * @license GPL-2.0+
 * @link    http://www.wpdevhq.com/themes/actions/
 */
//* Initialize Actions
actions();