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


PHP plugins::o方法代码示例

本文整理汇总了PHP中plugins::o方法的典型用法代码示例。如果您正苦于以下问题:PHP plugins::o方法的具体用法?PHP plugins::o怎么用?PHP plugins::o使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plugins的用法示例。


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

示例1: show_online

 /**
  * Вывод списка online-пользователей
  * @return null
  */
 public function show_online()
 {
     $i = (int) config::o()->v('online_interval');
     if (!$i) {
         $i = 15;
     }
     $time = time() - $i;
     $res = db::o()->p($time)->query('SELECT userdata FROM sessions
             WHERE time > ? GROUP BY IF(uid>0,uid,ip)');
     $res = db::o()->fetch2array($res);
     tpl::o()->assign("res", $res);
     $c = count($res);
     $mo = stats::o()->read("max_online");
     if (!intval($mo) || $mo < $c) {
         $mo = $c;
         stats::o()->write("max_online", $c);
         stats::o()->write("max_online_time", time());
     }
     $mot = stats::o()->read("max_online_time");
     tpl::o()->assign("record_total", $mo);
     tpl::o()->assign("record_time", $mot);
     /* @var $user user */
     $user = plugins::o()->get_module("user");
     lang::o()->get("profile");
     tpl::o()->register_modifier("gau", array($user, "get_age"));
     tpl::o()->assign("bdl", $this->bd_list());
     tpl::o()->display("blocks/contents/online.tpl");
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:32,代码来源:downm.php

示例2: install

 /**
  * Установка плагина
  * @param bool $re переустановка?
  * в данном случае необходимо лишь произвести изменения в файлах
  * @return bool статус установки
  * @note метод может возвращать false или 0, в случае, если была какая-то
  * критическая ошибка при удалении
  */
 public function install($re = false)
 {
     if (!$re) {
         config::o()->add('recaptcha_public_key', '', 'string', '', 'register');
         config::o()->add('recaptcha_private_key', '', 'string', '', 'register');
     }
     plugins::o()->insert_template('captcha.tpl', '[*recaptcha_show*][**');
     plugins::o()->insert_template('captcha.tpl', '**]', false);
     return true;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:18,代码来源:plugin.recaptcha.php

示例3: init

 /**
  * Инициализация блока контента
  * @return null
  */
 public function init()
 {
     lang::o()->get("content");
     if (!users::o()->perm('content')) {
         return;
     }
     /* @var $content content */
     $content = plugins::o()->get_module("content");
     if (!is_callable(array($content, "show"))) {
         return;
     }
     tpl::o()->assign('content_in_block', true);
     $content->show();
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:18,代码来源:content.php

示例4: init

 /**
  * Инициализация модуля обратной связи
  * @return null
  */
 public function init()
 {
     $admin_file = globals::g('admin_file');
     lang::o()->get('admin/feedback');
     $act = $_GET["act"];
     switch ($act) {
         case "clear":
             /* @var $o feedback_man_ajax */
             $o = plugins::o()->get_module('feedback', 1, true);
             $o->clear();
             furl::o()->location($admin_file);
             break;
         default:
             $this->show($_GET['sort'], $_GET['type']);
             break;
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:21,代码来源:feedback.php

示例5: init

 /**
  * Инициализация AJAX-части модуля
  * @return null
  * @throws EngineException
  */
 public function init()
 {
     $act = $_GET["act"];
     $plugin = $_POST['id'];
     switch ($act) {
         case "delete":
             $r = plugins::o()->manager->delete($plugin);
             break;
         case "check":
             /* @var $o plugis_man */
             $o = plugins::o()->get_module('plugins', 1);
             print $o->check($plugin);
             die;
             break;
         case "add":
             $r = plugins::o()->manager->add($plugin);
             break;
         case "reinstall":
             $r = plugins::o()->manager->install($plugin, true);
             break;
     }
     if (!$r) {
         throw new EngineException();
     }
     ok();
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:31,代码来源:plugins.php

示例6: clear_sitemap

 /**
  * Генерация sitemap.xml
  * @return null
  */
 protected function clear_sitemap()
 {
     /* @var $m main_page_ajax */
     $m = plugins::o()->get_module("main", 2, 1);
     $m->sitemap();
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:10,代码来源:class.cleanup.php

示例7: vote

 /**
  * Голосование в опросе
  * @param int $poll_id ID опроса
  * @param integer|array $answers ответы
  * @return bool true, в случае успешного завершения
  * @throws EngineException 
  */
 public function vote($poll_id, $answers)
 {
     if (!$this->state) {
         return;
     }
     users::o()->check_perms('polls', 1, 2);
     $poll_id = (int) $poll_id;
     if (!$answers) {
         throw new EngineException('polls_so_much_votes');
     }
     $answers = (array) (is_array($answers) ? array_map('intval', $answers) : array(longval($answers)));
     $user_id = (int) users::o()->v('id');
     $user_ip = users::o()->get_ip();
     $day = 60 * 60 * 24;
     $row = db::o()->p($user_id ? $user_id : $user_ip, $poll_id)->query('SELECT p.*,
         pv.question_id, pv.user_ip, pv.user_id FROM polls AS p
         LEFT JOIN poll_votes AS pv ON pv.question_id=p.id AND ' . ($user_id ? 'pv.user_id = ?' : 'pv.user_id=0 AND pv.user_ip = ?') . '
         WHERE p.id = ? LIMIT 1');
     $row = db::o()->fetch_assoc($row);
     if (!$row) {
         throw new EngineException();
     }
     if ((!$row['change_votes'] || !users::o()->v()) && $row['question_id']) {
         throw new EngineException('polls_you_re_voted');
     }
     if ($row['max_votes'] < count($answers) || !$answers) {
         throw new EngineException('polls_so_much_votes');
     }
     if ($row["poll_ends"]) {
         if (time() - $row["posted_time"] > $row["poll_ends"] * $day) {
             throw new EngineException('polls_already_ends');
         }
     }
     $update = array('answers_id' => serialize($answers));
     try {
         plugins::o()->pass_data(array("row" => &$row), true)->run_hook('polls_vote');
     } catch (PReturn $e) {
         return $e->r();
     }
     if (!$row['question_id']) {
         $update['user_id'] = $user_id;
         $update['question_id'] = $poll_id;
         $update['user_ip'] = $user_ip;
         db::o()->insert($update, 'poll_votes');
     } else {
         db::o()->p($row["user_id"], $row["user_ip"], $row['question_id'])->update($update, 'poll_votes', 'WHERE user_id = ?
                 AND user_ip = ? AND question_id=? LIMIT 1');
     }
     $this->uncache($poll_id, true);
     return true;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:58,代码来源:class.polls.php

示例8: o

 /**
  * Получение объекта класса
  * @return plugins $this
  */
 public static function o()
 {
     if (!self::$o) {
         self::$o = 1;
         // предотвращение зацикливания при вызове plugins::o() в плагине
         self::$o = new self();
     }
     return self::$o;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:13,代码来源:class.plugins.php

示例9: check_type

 /**
  * Проверка значения конфигурации
  * @param mixed $value значение параметра
  * @param string $type тип параметра
  * @param string $allowed допустимые значения
  * @param string $name имя параметра
  * @return bool true, в случае успешного завершения
  */
 public function check_type($type, &$value, $allowed = null, $name = null)
 {
     if ($type == 'other') {
         /* @var $o cofig_man */
         $o = plugins::o()->get_module('config', 1);
         return (bool) $o->check_field($name, $value);
     } elseif ($type == 'radio' || $type == 'select') {
         $allowed = explode(";", $allowed);
     }
     return input::o()->standart_types_check($type, $value, $allowed, config_man::config_prefix . $name);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:19,代码来源:config.php

示例10: save

 /**
  * Сохранение стат. страницы
  * @param array $data массив данных
  * @return null
  * @throws EngineException 
  */
 public function save($data)
 {
     $admin_file = globals::g('admin_file');
     $cols = array('url', 'title', 'content', 'type');
     $update = rex($data, $cols);
     $id = (int) $data['id'];
     if (!validword($update['url'])) {
         throw new EngineException('static_empty_url');
     }
     if (!$update['title']) {
         throw new EngineException('static_empty_title');
     }
     if ($update['type'] == 'html') {
         $update['content'] = $data['html'];
     } elseif ($update['type'] == 'tpl') {
         $update['content'] = $data['tpl'];
         if (!validpath($update['content']) || !tpl::o()->template_exists($update['content'])) {
             throw new EngineException('static_tpl_not_exists');
         }
     }
     if (!$update['content']) {
         throw new EngineException('static_empty_content');
     }
     try {
         plugins::o()->pass_data(array("update" => &$update, "id" => $id), true)->run_hook('admin_static_save');
     } catch (PReturn $e) {
         return $e->r();
     }
     if (!$id) {
         db::o()->insert($update, 'static');
         log_add('added_static', 'admin', $data['url']);
     } else {
         db::o()->p($id)->update($update, 'static', 'WHERE id=? LIMIT 1');
         log_add('changed_static', 'admin', $data['url']);
     }
     furl::o()->location($admin_file);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:43,代码来源:spages.php

示例11: input_form

 /**
  * Форма ввода текста с BB-кодами
  * @param string $name имя формы
  * @param string $text текст
  * @return string HTML код формы
  */
 public function input_form($name, $text = '')
 {
     if (is_array($name)) {
         $text = $name['text'];
         $name = $name['name'];
     }
     $this->init_smilies();
     lang::o()->get('bbcodes');
     $c = '';
     try {
         plugins::o()->pass_data(array('name' => $name, 'text' => $text, 'html' => &$c), true)->run_hook('bbcodes_input_form');
     } catch (PReturn $e) {
         return $e->r();
     }
     tpl::o()->assign("textarea_rname", $name);
     tpl::o()->assign("textarea_name", 'formid' . time() . $this->id++);
     tpl::o()->assign("textarea_text", $text);
     tpl::o()->assign("smilies", $this->smilies[1]);
     tpl::o()->assign("inited_bbcodes", $this->inited_js);
     if (!$this->inited_js) {
         $this->inited_js = true;
         $fs = array_merge($this->smilies[0], $this->smilies[1]);
         tpl::o()->assign('smilies_array', display::o()->array_export_to_js($fs));
     }
     $c .= tpl::o()->fetch('init_textinput.tpl');
     return $c;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:33,代码来源:class.bbcodes.php

示例12: die

    $plugins_isblock = 2;
    $admin_file = $iadmin_file . '&page=' . $admin_page;
    tpl::o()->assign("admin_file", $admin_file);
}
globals::s('admin_file', $admin_file);
/**
 * Загружаем модуль, или индексную страничку во вкладке
 */
if (!$ajax) {
    tpl::o()->display("admin/header.tpl");
} else {
    db::o()->nt_error();
    tpl::o()->assign("from_ajax", 1);
}
if ($module) {
    if (!allowed::o()->is($module, $allowed)) {
        die(lang::o()->v('module_not_exists'));
    }
    $m = plugins::o()->get_module($module, $plugins_isblock, $ajax && !$nno);
    try {
        plugins::o()->call_init($m);
    } catch (EngineException $e) {
        $e->defaultCatch();
    }
}
if (!$ajax) {
    tpl::o()->display("admin/footer.tpl");
} else {
    print '<script type="text/javascript">ajax_complete();</script>';
}
die;
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:31,代码来源:index.php

示例13: download

 /**
  * Скачивание вложения
  * @param int $id ID вложения
  * @return null
  * @throws EngineException
  */
 public function download($id)
 {
     if (!$this->state) {
         return;
     }
     users::o()->check_perms('attach', 1, 2);
     $id = (int) $id;
     $q = db::o()->p($id)->query("SELECT * FROM attachments WHERE id=? LIMIT 1");
     $row = db::o()->fetch_assoc($q);
     if (!$row) {
         throw new EngineException('file_not_exists');
     }
     $file = config::o()->v("attachments_folder") . "/" . self::attach_prefix . default_filename($row['time'], $row['user']);
     try {
         plugins::o()->pass_data(array("row" => &$row))->run_hook('attachments_download');
     } catch (PReturn $e) {
         return $e->r();
     }
     db::o()->p($id)->update(array("_cb_downloaded" => 'downloaded+1'), "attachments", 'WHERE id = ? LIMIT 1');
     /* @var $uploader uploader */
     $uploader = n("uploader");
     $uploader->download($file, display::o()->html_decode($row["filename"]));
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:29,代码来源:class.attachments.php

示例14: n

/**
 * Получение объекта переопределённого класса
 * @param string $class имя класса
 * @param bool $name только имя?
 * @return object объект класса
 */
function n($class, $name = false)
{
    if (!class_exists('plugins')) {
        return $name ? $class : new $class();
    }
    return plugins::o()->get_class($class, $name);
}
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:13,代码来源:functions.php

示例15: delete

 /**
  * Удаление типов файлов
  * @param string $id имя типа файлов
  * @return null
  */
 public function delete($id)
 {
     /* @var $aft allowedft_man */
     $aft = plugins::o()->get_module('allowedft', 1);
     if ($aft->is_basic($id)) {
         return;
     }
     db::o()->p($id)->delete('allowed_ft', 'WHERE name=? LIMIT 1');
     log_add('deleted_filetype', 'admin', $id);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:15,代码来源:allowedft.php


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