Inheritance: extends JContentEditorPlugin
Beispiel #1
0
 private function upload()
 {
     if (empty($_FILES)) {
         $this->output = array("error" => "Нет файлов для загрузки");
         return;
     }
     //получаем информацию о загружаемом файле
     $this->fname = $_FILES['Filedata']['tmp_name'];
     $this->fext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);
     $this->fsize = $_FILES['Filedata']['size'];
     $this->target_fname = md5($_FILES['Filedata']['name']) . '.' . $this->fext;
     $this->target_full_path = PUBLIC_DIR . $this->target_path . $this->target_fname;
     if (!(list($sizeX, $sizeY) = getimagesize($this->fname))) {
         $this->output = array("error" => "Ошибка размера изображения");
         return;
     }
     //проверяем расширение
     if (!in_array($this->fext, $this->allowed_extensions)) {
         $this->output = array("error" => $this->fext . " - неразрешенный тип файла");
         return;
     }
     //проверяем размер
     if ($this->fsize > $this->allowed_filesize) {
         $this->output = array("error" => "Размер файла превышает допустимое значение");
         return;
     }
     //сохраняем временный файл,
     if (!move_uploaded_file($this->fname, $this->target_full_path)) {
         $this->output = array("error" => "Не удалось сохранить файл");
         return;
     }
     // создаем превьюшку
     $preview = new Preview($this->target_full_path);
     $this->output = array("success" => "Файл успешно загружен", "path" => DIRECTORY_SEPARATOR . $this->target_path . $this->target_fname, "preview" => $preview->get_preview_filename());
 }
Beispiel #2
0
 function upload($image, $storetime = "30 Minutes", $obscure_filename = "basic", $accept_rules = "Yes")
 {
     $path_to_image = "{$GLOBALS['settings']['YourCompany']['file_server_base']}/files/{$image}";
     $this->upload = $path_to_image;
     $this->storetime = "label={$storetime}";
     $this->obscure_filename = "label={$obscure_filename}";
     $this->accept_rules = "label={$accept_rules}";
     self::$selenium->click($this->locators['button']);
     $p = new Preview();
     $p->wait_until_loaded();
     return $p;
 }
Beispiel #3
0
 function upload($image, $storetime = "30 Minutes", $obscure_filename = "basic", $accept_rules = "Yes")
 {
     $path_to_image = "{$GLOBALS['settings']['saunter.base']}/support/files/{$image}";
     $this->upload = $path_to_image;
     $this->storetime = $storetime;
     $this->obscure_filename = $obscure_filename;
     $this->accept_rules = $accept_rules;
     $b = call_user_func_array(array(self::$session, "element"), $this->locators['button']);
     $b->click();
     $p = new Preview(self::$session);
     $p->wait_until_loaded();
     return $p;
 }
Beispiel #4
0
 public static function post_delete($args)
 {
     $path = $args['path'];
     if (substr($path, 0, 1) === '/') {
         $path = substr($path, 1);
     }
     $preview = new Preview(\OC_User::getUser(), 'files/', $path);
     $preview->deleteAllPreviews();
 }
Beispiel #5
0
    {
        $this->import('BackendUser', 'User');
        parent::__construct();
        $this->User->authenticate();
        $this->loadLanguageFile('default');
    }
    /**
     * Run the controller and parse the template
     */
    public function run()
    {
        $this->Template = new BackendTemplate('be_preview');
        $this->Template->base = Environment::get('base');
        $this->Template->language = $GLOBALS['TL_LANGUAGE'];
        $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['fePreview']);
        $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
        $this->Template->site = Input::get('site', true);
        if (Input::get('page')) {
            $this->Template->url = $this->redirectToFrontendPage(Input::get('page'), Input::get('article'), true);
        } else {
            $this->Template->url = Environment::get('base');
        }
        $GLOBALS['TL_CONFIG']['debugMode'] = false;
        $this->Template->output();
    }
}
/**
 * Instantiate the controller
 */
$objPreview = new Preview();
$objPreview->run();
Beispiel #6
0
 function afterRoute($f3)
 {
     $f3->set('active', 'Multilang');
     echo \Preview::instance()->render('tests.htm');
 }
Beispiel #7
0
<?php

require_once '../../core/require.php';
require_once 'utils.class.php';
require_once 'preview.class.php';
if (!isset($_GET['f'])) {
    die;
}
$preview = new Preview($_GET['f']);
echo strtr(file_get_contents('./view/index.html'), array('{title}' => '預覽', '{dir}' => '/', '{side}' => Util::showDirList(Util::listDirOnly(Util::getUserDir())), '{content}' => '<p class="lead">預覽</p>' . $preview->renderHTML(), '{scripts}' => '<style>
</style><script>
$(function(){
	$(\'.tree-indicator\').click(function(){
		var $state = $(this).html();
		$(this).parent().find(\'ul.dir-tree\').slideToggle(500);
		$(this).text($state == \'+\' ? \'-\' : \'+\');
	});
});
</script>'));
Beispiel #8
0
 /**
  *	Configure framework according to .ini-style file settings;
  *	If optional 2nd arg is provided, template strings are interpreted
  *	@return object
  *	@param $file string
  *	@param $allow bool
  **/
 function config($file, $allow = FALSE)
 {
     preg_match_all('/(?<=^|\\n)(?:' . '\\[(?<section>.+?)\\]|' . '(?<lval>[^\\h\\r\\n;].*?)\\h*=\\h*' . '(?<rval>(?:\\\\\\h*\\r?\\n|.+?)*)' . ')(?=\\r?\\n|$)/', $this->read($file), $matches, PREG_SET_ORDER);
     if ($matches) {
         $sec = 'globals';
         foreach ($matches as $match) {
             if ($match['section']) {
                 $sec = $match['section'];
                 if (preg_match('/^(?!(?:global|config|route|map|redirect)s\\b)' . '((?:\\.?\\w)+)/i', $sec, $msec) && !$this->exists($msec[0])) {
                     $this->set($msec[0], NULL);
                 }
             } else {
                 if ($allow) {
                     $match['lval'] = Preview::instance()->resolve($match['lval']);
                     $match['rval'] = Preview::instance()->resolve($match['rval']);
                 }
                 if (preg_match('/^(config|route|map|redirect)s\\b/i', $sec, $cmd)) {
                     call_user_func_array(array($this, $cmd[1]), array_merge(array($match['lval']), str_getcsv($match['rval'])));
                 } else {
                     $args = array_map(function ($val) {
                         if (is_numeric($val)) {
                             return $val + 0;
                         }
                         $val = ltrim($val);
                         if (preg_match('/^\\w+$/i', $val) && defined($val)) {
                             return constant($val);
                         }
                         return trim(preg_replace(array('/\\\\"/', '/\\\\\\h*(\\r?\\n)/'), array('"', '\\1'), $val));
                     }, str_getcsv(preg_replace('/(?<!\\\\)(")(.*?)\\1/', "\\1\\2\\1", $match['rval'])));
                     preg_match('/^(?<section>[^:]+)(?:\\:(?<func>.+))?/', $sec, $parts);
                     $func = isset($parts['func']) ? $parts['func'] : NULL;
                     $custom = strtolower($parts['section']) != 'globals';
                     if ($func) {
                         $args = array($this->call($func, count($args) > 1 ? array($args) : $args));
                     }
                     call_user_func_array(array($this, 'set'), array_merge(array(($custom ? $parts['section'] . '.' : '') . $match['lval']), count($args) > 1 ? array($args) : $args));
                 }
             }
         }
     }
     return $this;
 }
Beispiel #9
0
 /**
  *	Assemble markup
  *	@return string
  *	@param $node array|string
  **/
 function build($node)
 {
     if (is_string($node)) {
         return parent::build($node);
     }
     $out = '';
     foreach ($node as $key => $val) {
         $out .= is_int($key) ? $this->build($val) : $this->{'_' . $key}($val);
     }
     return $out;
 }
Beispiel #10
0
 /**
  *	Configure framework according to .ini-style file settings;
  *	If optional 2nd arg is provided, template strings are interpreted
  *	@return object
  *	@param $file string
  *	@param $allow bool
  **/
 function config($file, $allow = FALSE)
 {
     preg_match_all('/(?<=^|\\n)(?:' . '\\[(?<section>.+?)\\]|' . '(?<lval>[^\\h\\r\\n;].*?)\\h*=\\h*' . '(?<rval>(?:\\\\\\h*\\r?\\n|.+?)*)' . ')(?=\\r?\\n|$)/', $this->read($file), $matches, PREG_SET_ORDER);
     if ($matches) {
         $sec = 'globals';
         $cmd = [];
         foreach ($matches as $match) {
             if ($match['section']) {
                 $sec = $match['section'];
                 if (preg_match('/^(?!(?:global|config|route|map|redirect)s\\b)' . '((?:\\.?\\w)+)/i', $sec, $msec) && !$this->exists($msec[0])) {
                     $this->set($msec[0], NULL);
                 }
                 preg_match('/^(config|route|map|redirect)s\\b|' . '^((?:\\.?\\w)+)\\s*\\>\\s*(.*)/i', $sec, $cmd);
             } else {
                 if ($allow) {
                     $match['lval'] = Preview::instance()->resolve($match['lval']);
                     $match['rval'] = Preview::instance()->resolve($match['rval']);
                 }
                 if (!empty($cmd)) {
                     isset($cmd[3]) ? $this->call($cmd[3], [$match['lval'], $match['rval'], $cmd[2]]) : call_user_func_array([$this, $cmd[1]], array_merge([$match['lval']], str_getcsv($match['rval'])));
                 } else {
                     $rval = preg_replace('/\\\\\\h*(\\r?\\n)/', '\\1', $match['rval']);
                     $ttl = NULL;
                     if (preg_match('/^(.+)\\|\\h*(\\d+)$/', $rval, $tmp)) {
                         array_shift($tmp);
                         list($rval, $ttl) = $tmp;
                     }
                     $args = array_map(function ($val) {
                         if (is_numeric($val)) {
                             return $val + 0;
                         }
                         $val = trim($val);
                         if (preg_match('/^\\w+$/i', $val) && defined($val)) {
                             return constant($val);
                         }
                         return preg_replace('/\\\\"/', '"', $val);
                     }, str_getcsv(preg_replace('/(?<!\\\\)(")(.*?)\\1/', "\\1\\2\\1", trim($rval))));
                     preg_match('/^(?<section>[^:]+)(?:\\:(?<func>.+))?/', $sec, $parts);
                     $func = isset($parts['func']) ? $parts['func'] : NULL;
                     $custom = strtolower($parts['section']) != 'globals';
                     if ($func) {
                         $args = [$this->call($func, $args)];
                     }
                     if (count($args) > 1) {
                         $args = [$args];
                     }
                     if (isset($ttl)) {
                         $args = array_merge($args, [$ttl]);
                     }
                     call_user_func_array([$this, 'set'], array_merge([($custom ? $parts['section'] . '.' : '') . $match['lval']], $args));
                 }
             }
         }
     }
     return $this;
 }
Beispiel #11
0
<?php

/**
 * default settings
 */
namespace Preview;

return array("reporter" => "\\Preview\\Reporter\\Spec", "assertion_exceptions" => array("\\Exception"), "convert_error_to_exception" => true, "fail_fast" => false, "color_support" => Preview::is_tty(), "full_backtrace" => false, "test_groups" => array(), "exclude_groups" => array(), "title" => null, "order" => false, "custom_filters" => array(), "use_implicit_context" => !Preview::is_php53(), "spec_file_regexp" => '/_spec\\.php/', "shared_dir_name" => "shared", "before_hook" => null, "after_hook" => null, "before_each_hook" => null, "after_each_hook" => null);
Beispiel #12
0
<?php

/**
* @version		$Id: browser.php 158 2009-07-11 13:20:12Z happynoodleboy $
* @package      JCE
* @copyright    Copyright (C) 2005 - 2009 Ryan Demmer. All rights reserved.
* @author		Ryan Demmer
* @license      GNU/GPL
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
defined('_JEXEC') or die('Restricted access');
require_once dirname(__FILE__) . DS . 'classes' . DS . 'preview.php';
$preview =& Preview::getInstance();
$preview->display();
Beispiel #13
0
 public static function Plupload($fieldname, $value, $type, $multiple = false, $preview = true, $runtime = null)
 {
     $upl = PluploadSkeleton::getButton($fieldname, $type, false, $multiple, null, $runtime);
     if (!is_null($value) && $preview) {
         $upl .= Preview::preview($value);
     }
     return $upl;
 }
Beispiel #14
0
 /**
  * Update
  *
  * @param array $options
  * @return null
  */
 public function update($options)
 {
     $attrs = array_keys(get_object_vars($this));
     foreach ($options as $key => $value) {
         if (in_array($key, $attrs)) {
             $this->{$key} = $value;
         }
     }
     if (is_string($this->reporter)) {
         $this->reporter = new $this->reporter();
     }
     /*
      * Since for PHP version < 5.4 $this is not available for closure,
      * We can't use this feature, instead we explicitly pass
      * the context object as an argument to callback.
      */
     if (Preview::is_php53()) {
         $this->use_implicit_context = false;
     }
     if (!Preview::is_tty()) {
         $this->color_support = false;
     }
 }
 public function getCallData()
 {
     return parent::getCallData();
 }