当前位置: 首页>>代码示例>>PHP>>正文


PHP Liten\Liten类代码示例

本文整理汇总了PHP中Liten\Liten的典型用法代码示例。如果您正苦于以下问题:PHP Liten类的具体用法?PHP Liten怎么用?PHP Liten使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Liten类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateCronjobs

/**
 * Updates a cronjob handler.
 *
 * @since 6.0.00
 */
function updateCronjobs($id = '')
{
    $app = \Liten\Liten::getInstance();
    $cronDir = cronDir() . 'cron/';
    if (file_put_contents($cronDir . 'cronjobs.dat.php', '<' . '?php /*' . base64_encode(serialize($_SESSION['cronjobs'])) . '*/')) {
        $app->flash('success_message', _t('Database saved.'));
        // create 'backup'
        file_put_contents($cronDir . 'cronjobs.backup-' . date('Y-m-d') . '.php', '<' . '?php /*' . base64_encode(serialize($_SESSION['cronjobs'])) . '*/');
    } else {
        $app->flash('error_message', _t('Database not saved, could not create database file on server, please check write rights of this script.'));
    }
    // remove old cronjob backup files
    $files = glob($cronDir . 'cronjobs.backup*.php');
    if (is_array($files)) {
        foreach ($files as $file) {
            if (is_file($file) && time() - filemtime($file) >= 2 * 24 * 60 * 60) {
                // 2 days
                unlink($file);
            }
        }
    }
    if ($id != '' && is_numeric($id)) {
        redirect(get_base_url() . 'cron/view' . '/' . $id);
    } else {
        redirect($app->req->server['HTTP_REFERER']);
    }
    exit;
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:33,代码来源:cron.router.php

示例2: eae_encode_emails

/**
 * Searches for plain email addresses in given $string and
 * encodes them (by default) with the help of eae_encode_str().
 *
 * Regular expression is based on based on John Gruber's Markdown.
 * http://daringfireball.net/projects/markdown/
 *
 * @param string $string
 *            Text with email addresses to encode
 * @return string $string Given text with encoded email addresses
 */
function eae_encode_emails($string)
{
    $app = \Liten\Liten::getInstance();
    // abort if $string doesn't contain a @-sign
    if ($app->hook->apply_filter('eae_at_sign_check', true)) {
        if (strpos($string, '@') === false) {
            return $string;
        }
    }
    // override encoding function with the 'eae_method' filter
    $method = $app->hook->apply_filter('eae_method', 'eae_encode_str');
    // override regex pattern with the 'eae_regexp' filter
    $regexp = $app->hook->apply_filter('eae_regexp', '{
			(?:mailto:)?
			(?:
				[-!#$%&*+/=?^_`.{|}~\\w\\x80-\\xFF]+
			|
				".*?"
			)
			\\@
			(?:
				[-a-z0-9\\x80-\\xFF]+(\\.[-a-z0-9\\x80-\\xFF]+)*\\.[a-z]+
			|
				\\[[\\d.a-fA-F:]+\\]
			)
		}xi');
    return preg_replace_callback($regexp, create_function('$matches', 'return ' . $method . '($matches[0]);'), $string);
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:39,代码来源:email-address-encoder.php

示例3: _etsis_cache_init

/**
 * Sets up object cache global scope and assigns it based on
 * the type of caching system used.
 *
 * @since 6.2.0
 */
function _etsis_cache_init()
{
    $app = \Liten\Liten::getInstance();
    $driver = $app->hook->apply_filter('etsis_cache_driver', 'file');
    $cache = new \app\src\Core\Cache\etsis_Object_Cache($driver);
    return $cache;
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:13,代码来源:global-function.php

示例4: etsis_push_notify

/**
 * Desktop Push Notification
 * 
 * Notifications that can be pushed at a delayed time.
 * 
 * @since 6.2.11
 * @param string $title Give title of notification.
 * @param string $message Message that should be displayed.
 */
function etsis_push_notify($title, $message)
{
    $app = \Liten\Liten::getInstance();
    // Create a Notifier
    $notifier = NotifierFactory::create();
    // Create your notification
    $notification = (new Notification())->setTitle($title)->setBody($message)->setIcon(BASE_PATH . 'static/assets/imgages/icon-success.png');
    // Send it
    return $app->hook->apply_filter('push_notify', $notifier->send($notification));
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:19,代码来源:notify-function.php

示例5: __construct

 public function __construct($personID = '')
 {
     $this->_app = \Liten\Liten::getInstance();
     if ($personID != '') {
         $this->_personID = floatval($personID);
     } else {
         $this->_personID = floatval(get_persondata('personID'));
     }
     $this->_userRoles = $this->getUserRoles('ids');
     $this->buildACL();
 }
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:11,代码来源:ACL.php

示例6: update_prog_crse_column

function update_prog_crse_column($data)
{
    $app = \Liten\Liten::getInstance();
    if (count($data)) {
        $id = $data['rid'];
        unset($data['rid']);
        $sql = $app->db->query("UPDATE prog_crse SET " . key($data) . "='" . $data[key($data)] . "' WHERE ID = ? LIMIT 1", [$id]);
        if ($sql->update()) {
            return $id;
        }
        return 0;
    }
}
开发者ID:parkerj,项目名称:degree-audit,代码行数:13,代码来源:functions.php

示例7: __construct

 public function __construct(\Liten\Liten $liten = null)
 {
     $this->app = !empty($liten) ? $liten : \Liten\Liten::getInstance();
     if (!extension_loaded('apc') && !ini_get('apc.enabled') || !function_exists('apc_fetch')) {
         return new \app\src\Core\Exception\Exception(_t('APC requires PHP APC extension to be installed and loaded.'), 'php_apc_extension');
     }
     /**
      * Filter sets whether caching is enabled or not.
      *
      * @since 6.2.0
      * @var bool
      */
     $this->enable = $this->app->hook->apply_filter('enable_caching', true);
 }
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:14,代码来源:etsis_Cache_APC.php

示例8: __construct

 public function __construct($driver, \Liten\Liten $liten = null)
 {
     $this->app = !empty($liten) ? $liten : \Liten\Liten::getInstance();
     if ($driver == 'file') {
         $this->_cache = new \app\src\Core\Cache\etsis_Cache_Filesystem();
     } elseif ($driver == 'apc') {
         $this->_cache = new \app\src\Core\Cache\etsis_Cache_APC();
     } elseif ($driver == 'memcache') {
         /**
          * Filter whether to use `\Memcache`|`\Memcached`.
          *
          * @since 6.2.0
          * @param
          *            bool false Use `\Memcache`|`\Memcached`. Default is false.
          */
         $useMemcached = $this->app->hook->apply_filter('use_memcached', false);
         $this->_cache = new \app\src\Core\Cache\etsis_Cache_Memcache($useMemcached);
         $pool = [['host' => '127.0.0.1', 'port' => 11211, 'weight' => 20]];
         /**
          * Filter the `\Memcache`|`\Memcached` server pool.
          *
          * @since 6.2.0
          * @param array $pool
          *            Array of servers to add to the connection pool.
          */
         $servers = $this->app->hook->apply_filter('memcache_server_pool', $pool);
         $this->_cache->addServer($servers);
     } elseif ($driver == 'external') {
         /**
          * Fires when being used to call another caching system not
          * native to eduTrac SIS.
          *
          * @since 6.2.0
          */
         $this->_cache = $this->app->hook->do_action('external_cache_driver');
     } elseif ($driver == 'xcache') {
         $this->_cache = new \app\src\Core\Cache\etsis_Cache_XCache();
     } elseif ($driver == 'cookie') {
         $this->_cache = new \app\src\Core\Cache\etsis_Cache_Cookie();
     } elseif ($driver == 'json') {
         $this->_cache = new \app\src\Core\Cache\etsis_Cache_JSON();
     } elseif ($driver == 'memory') {
         $this->_cache = new \app\src\Core\Cache\etsis_Cache_Memory();
     }
     if (is_etsis_exception($this->_cache)) {
         return $this->_cache->getMessage();
     }
     return $this->_cache;
 }
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:49,代码来源:etsis_Object_Cache.php

示例9: convertCourseSec

/**
 *
 * @since 4.4
 */
function convertCourseSec($sect)
{
    $app = \Liten\Liten::getInstance();
    $section = $app->db->course_sec()->select('courseSecCode')->where('courseSecID = ?', $sect);
    $q = $section->find(function ($data) {
        $array = [];
        foreach ($data as $d) {
            $array[] = $d;
        }
        return $array;
    });
    foreach ($q as $r) {
        $section = $r['courseSecCode'];
    }
    return $section;
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:20,代码来源:section-function.php

示例10: subject_code_dropdown

/**
 * Subject dropdown: shows general list of subjects and
 * if $subjectCode is not NULL, shows the subject attached
 * to a particular record.
 *
 * @deprecated since release 6.1.12
 * @see table_dropdown
 * @since 1.0.0
 * @param string $subjectCode
 *            - optional
 * @return string Returns the record key if selected is true.
 */
function subject_code_dropdown($subjectCode = NULL)
{
    _deprecated_function(__FUNCTION__, '6.1.12', 'table_dropdown');
    $app = \Liten\Liten::getInstance();
    $subj = $app->db->subject()->select('subjectCode,subjectName')->where('subjectCode <> "NULL"');
    $q = $subj->find(function ($data) {
        $array = [];
        foreach ($data as $d) {
            $array[] = $d;
        }
        return $array;
    });
    foreach ($q as $v) {
        echo '<option value="' . _h($v['subjectCode']) . '"' . selected($subjectCode, _h($v['subjectCode']), false) . '>' . _h($v['subjectCode']) . ' ' . _h($v['subjectName']) . '</option>' . "\n";
    }
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:28,代码来源:deprecated-function.php

示例11: courseList

/**
 * Prints a list of active courses.
 */
function courseList($id = '')
{
    $app = \Liten\Liten::getInstance();
    $crse = $app->db->course()->select('courseCode')->where('courseID <> ?', $id)->_and_()->where('currStatus = "A"')->_and_()->where('endDate <= "0000-00-00"');
    $q = $crse->find(function ($data) {
        $array = [];
        foreach ($data as $d) {
            $array[] = $d;
        }
        return $array;
    });
    $a = [];
    foreach ($q as $r) {
        $a[] = $r['courseCode'];
    }
    return $a;
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:20,代码来源:course-function.php

示例12: degree_audit_tables

function degree_audit_tables()
{
    $app = \Liten\Liten::getInstance();
    $now = date('Y-m-d h:i:s');
    $hd = $app->db->query('SHOW TABLES LIKE "da_group"');
    $q = $hd->find(function ($data) {
        $array = [];
        foreach ($data as $d) {
            $array[] = $d;
        }
        return $array;
    });
    if (count($q) <= 0) {
        $sql = [];
        $sql = "";
        foreach ($sql as $query) {
            $app->db->query($query);
        }
    }
}
开发者ID:parkerj,项目名称:degree-audit,代码行数:20,代码来源:degree-audit.plugin.php

示例13: __construct

 public function __construct($useMemcached, \Liten\Liten $liten = null)
 {
     $this->app = !empty($liten) ? $liten : \Liten\Liten::getInstance();
     $this->useMemcached = $useMemcached;
     $ext = $this->useMemcached ? 'memcached' : 'memcache';
     if ($ext == 'memcached' && !class_exists('memcached')) {
         return new \app\src\Core\Exception\Exception(sprintf(_t('Memcached requires PHP <strong>%s</strong> extension to be loaded.'), $ext), 'php_memcache_extension');
     }
     if ($ext == 'memcache' && !function_exists('memcache_connect')) {
         return new \app\src\Core\Exception\Exception(sprintf(_t('Memcached requires PHP <strong>%s</strong> extension to be loaded.'), $ext), 'php_memcache_extension');
     }
     if ($ext == 'memcache') {
         $this->connection = new \Memcache();
     } else {
         $this->connection = new \Memcached('etsis');
     }
     /**
      * Filter sets whether caching is enabled or not.
      *
      * @since 6.2.0
      * @var bool
      */
     $this->enable = $this->app->hook->apply_filter('enable_caching', true);
 }
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:24,代码来源:etsis_Cache_Memcache.php

示例14: url

/**
 * Returns the url based on route.
 */
function url($route)
{
    $app = \Liten\Liten::getInstance();
    $url = $app->req->url_for($route);
    return $url;
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:9,代码来源:functions.php

示例15: etsis_nodeq_change_address

/**
 * Change of Address Email
 * 
 * Function used to send change of address to
 * appropriate staff member.
 * 
 * @since 6.2.11
 */
function etsis_nodeq_change_address()
{
    $app = \Liten\Liten::getInstance();
    $email = _etsis_email();
    $host = $app->req->server['HTTP_HOST'];
    $site = _t('myeduTrac :: ') . _h(get_option('institution_name'));
    // Creates node's schema if does not exist.
    Node::dispense('change_address');
    try {
        $sql = Node::table('change_address')->where('sent', '=', 0)->findAll();
        if ($sql->count() == 0) {
            Node::table('change_address')->delete();
        }
        $numItems = $sql->count();
        $i = 0;
        if ($sql->count() > 0) {
            foreach ($sql as $r) {
                $message = _escape(get_option('coa_form_text'));
                $message = str_replace('#uname#', _h($r->uname), $message);
                $message = str_replace('#fname#', _h($r->fname), $message);
                $message = str_replace('#lname#', _h($r->lname), $message);
                $message = str_replace('#name#', get_name(_h($r->personid)), $message);
                $message = str_replace('#id#', _h($r->personid), $message);
                $message = str_replace('#address1#', _h($r->address1), $message);
                $message = str_replace('#address2#', _h($r->address2), $message);
                $message = str_replace('#city#', _h($r->city), $message);
                $message = str_replace('#state#', _h($r->state), $message);
                $message = str_replace('#zip#', _h($r->zip), $message);
                $message = str_replace('#country#', _h($r->country), $message);
                $message = str_replace('#phone#', _h($r->phone), $message);
                $message = str_replace('#email#', _h($r->email), $message);
                $message = str_replace('#adminemail#', _h(get_option('system_email')), $message);
                $message = str_replace('#url#', get_base_url(), $message);
                $message = str_replace('#helpdesk#', _h(get_option('help_desk')), $message);
                $message = str_replace('#currentterm#', _h(get_option('current_term_code')), $message);
                $message = str_replace('#instname#', _h(get_option('institution_name')), $message);
                $message = str_replace('#mailaddr#', _h(get_option('mailing_address')), $message);
                $headers = "From: {$site} <auto-reply@{$host}>\r\n";
                $headers .= "X-Mailer: PHP/" . phpversion();
                $headers .= "MIME-Version: 1.0" . "\r\n";
                $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
                $email->etsis_mail(_h(get_option('contact_email')), _t('Change of Address Request'), $message, $headers);
                $upd = Node::table('change_address')->find(_h($r->id));
                $upd->sent = 1;
                $upd->save();
                if (++$i === $numItems) {
                    //If we reach the last item, send user a desktop notification.
                    etsis_push_notify('Change of Address', 'Request has been submitted.');
                }
            }
        }
    } catch (\Exception $e) {
        return new \app\src\Core\Exception\Exception($e->getMessage(), 'NodeQ');
    }
}
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:63,代码来源:nodeq-function.php


注:本文中的Liten\Liten类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。