コード例 #1
7
function ote_accent($str)
{
    $str = str_replace("'", " ", $str);
    $str = utf8_decode($str);
    $ch = strtr($str, '����������������������������������������������������', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
    return utf8_encode($ch);
}
コード例 #2
2
ファイル: pages.php プロジェクト: ishawge/jorani
 /**
  * Display a page with this order of priority (based on the provided page name) :
  *  1. Does the page exist into local/pages/{lang}/ (this allows you to overwrite default pages)?
  *  2. Does the page exist into the views available in views/pages/ folder?
  * Pages are not public and we take into account the language of the connected user.
  * If the page name contains the keyword export, then we don't output the default template.
  * @param string $page Name of the view (and of the corresponding PHP file)
  * @author Benjamin BALET <*****@*****.**>
  */
 public function view($page = 'home')
 {
     $data = getUserContext($this);
     $trans = array("-" => " ", "_" => " ", "." => " ");
     $data['title'] = ucfirst(strtr($page, $trans));
     // Capitalize the first letter
     //The page containing export in their name are returning another MIMETYPE
     if (strpos($page, 'export') === FALSE) {
         //Don't include header and menu
         $this->load->view('templates/header', $data);
         $this->load->view('menu/index', $data);
     }
     $view = 'pages/' . $this->language_code . '/' . $page . '.php';
     $pathCI = APPPATH . 'views/';
     $pathLocal = FCPATH . 'local/';
     //Check if we have a user-defined view
     if (file_exists($pathLocal . $view)) {
         $this->load->customView($pathLocal, $view, $data);
     } else {
         //Load the page from the default location (CI views folder)
         if (!file_exists($pathCI . $view)) {
             redirect('notfound');
         }
         $this->load->view($view, $data);
     }
     if (strpos($page, 'export') === FALSE) {
         $this->load->view('templates/footer', $data);
     }
 }
コード例 #3
1
ファイル: entry.php プロジェクト: xp-runners/main
function entry(&$argv)
{
    if (is_file($argv[0])) {
        if (0 === substr_compare($argv[0], '.class.php', -10)) {
            $uri = realpath($argv[0]);
            if (null === ($cl = \lang\ClassLoader::getDefault()->findUri($uri))) {
                throw new \Exception('Cannot load ' . $uri . ' - not in class path');
            }
            return $cl->loadUri($uri)->literal();
        } else {
            if (0 === substr_compare($argv[0], '.xar', -4)) {
                $cl = \lang\ClassLoader::registerPath($argv[0]);
                if (!$cl->providesResource('META-INF/manifest.ini')) {
                    throw new \Exception($cl->toString() . ' does not provide a manifest');
                }
                $manifest = parse_ini_string($cl->getResource('META-INF/manifest.ini'));
                return strtr($manifest['main-class'], '.', '\\');
            } else {
                array_unshift($argv, 'eval');
                return 'xp\\runtime\\Evaluate';
            }
        }
    } else {
        return strtr($argv[0], '.', '\\');
    }
}
コード例 #4
1
ファイル: FdfFile.php プロジェクト: aviddv1/php-pdftk
 /**
  * Constructor
  *
  * @param array $data the form data as name => value
  * @param string|null $suffix the optional suffix for the tmp file
  * @param string|null $suffix the optional prefix for the tmp file. If null 'php_tmpfile_' is used.
  * @param string|null $directory directory where the file should be created. Autodetected if not provided.
  * @param string|null $encoding of the data. Default is 'UTF-8'.
  */
 public function __construct($data, $suffix = null, $prefix = null, $directory = null, $encoding = 'UTF-8')
 {
     if ($directory === null) {
         $directory = self::getTempDir();
     }
     $suffix = '.fdf';
     $prefix = 'php_pdftk_fdf_';
     $this->_fileName = tempnam($directory, $prefix);
     $newName = $this->_fileName . $suffix;
     rename($this->_fileName, $newName);
     $this->_fileName = $newName;
     $fields = '';
     foreach ($data as $key => $value) {
         // Create UTF-16BE string encode as ASCII hex
         // See http://blog.tremily.us/posts/PDF_forms/
         $utf16Value = mb_convert_encoding($value, 'UTF-16BE', $encoding);
         /* Also create UTF-16BE encoded key, this allows field names containing
          * german umlauts and most likely many other "special" characters.
          * See issue #17 (https://github.com/mikehaertl/php-pdftk/issues/17)
          */
         $utf16Key = mb_convert_encoding($key, 'UTF-16BE', $encoding);
         // Escape parenthesis
         $utf16Value = strtr($utf16Value, array('(' => '\\(', ')' => '\\)'));
         $fields .= "<</T(" . chr(0xfe) . chr(0xff) . $utf16Key . ")/V(" . chr(0xfe) . chr(0xff) . $utf16Value . ")>>\n";
     }
     // Use fwrite, since file_put_contents() messes around with character encoding
     $fp = fopen($this->_fileName, 'w');
     fwrite($fp, self::FDF_HEADER);
     fwrite($fp, $fields);
     fwrite($fp, self::FDF_FOOTER);
     fclose($fp);
 }
コード例 #5
1
/**
 * Sanitizes $message, taking into account our special codes
 * for formatting.
 *
 * If you want to include result in element attribute, you should escape it.
 *
 * Examples:
 *
 * <p><?php echo PMA_sanitize($foo); ?></p>
 *
 * <a title="<?php echo PMA_sanitize($foo, true); ?>">bar</a>
 *
 * @uses    preg_replace()
 * @uses    strtr()
 * @param   string   the message
 * @param   boolean  whether to escape html in result
 *
 * @return  string   the sanitized message
 *
 * @access  public
 */
function PMA_sanitize($message, $escape = false, $safe = false)
{
    if (!$safe) {
        $message = strtr($message, array('<' => '&lt;', '>' => '&gt;'));
    }
    $replace_pairs = array('[i]' => '<em>', '[/i]' => '</em>', '[em]' => '<em>', '[/em]' => '</em>', '[b]' => '<strong>', '[/b]' => '</strong>', '[strong]' => '<strong>', '[/strong]' => '</strong>', '[tt]' => '<code>', '[/tt]' => '</code>', '[code]' => '<code>', '[/code]' => '</code>', '[kbd]' => '<kbd>', '[/kbd]' => '</kbd>', '[br]' => '<br />', '[/a]' => '</a>', '[sup]' => '<sup>', '[/sup]' => '</sup>');
    $message = strtr($message, $replace_pairs);
    $pattern = '/\\[a@([^"@]*)@([^]"]*)\\]/';
    if (preg_match_all($pattern, $message, $founds, PREG_SET_ORDER)) {
        $valid_links = array('http', './Do', './ur');
        foreach ($founds as $found) {
            // only http... and ./Do... allowed
            if (!in_array(substr($found[1], 0, 4), $valid_links)) {
                return $message;
            }
            // a-z and _ allowed in target
            if (!empty($found[2]) && preg_match('/[^a-z_]+/i', $found[2])) {
                return $message;
            }
        }
        if (substr($found[1], 0, 4) == 'http') {
            $message = preg_replace($pattern, '<a href="' . PMA_linkURL($found[1]) . '" target="\\2">', $message);
        } else {
            $message = preg_replace($pattern, '<a href="\\1" target="\\2">', $message);
        }
    }
    if ($escape) {
        $message = htmlspecialchars($message);
    }
    return $message;
}
コード例 #6
0
ファイル: general.php プロジェクト: kdexter/oscommerce
/**
 * Parse and output a user submited value
 *
 * @param string $string The string to parse and output
 * @param array $translate An array containing the characters to parse
 * @access public
 */
function osc_output_string($string, $translate = null)
{
    if (empty($translate)) {
        $translate = array('"' => '&quot;');
    }
    return strtr(trim($string), $translate);
}
コード例 #7
0
/**
 * Converts a title into an alias
 *
 * @param string $title Title
 * @param int $id Page ID
 * @param bool $duplicate TRUE if duplicate alias was previously detected
 * @return string
 */
function autoalias2_convert($title, $id = 0, $duplicate = false)
{
    global $cfg, $cot_translit, $cot_translit_custom;
    if ($cfg['plugin']['autoalias2']['translit'] && file_exists(cot_langfile('translit', 'core'))) {
        include cot_langfile('translit', 'core');
        if (is_array($cot_translit_custom)) {
            $title = strtr($title, $cot_translit_custom);
        } elseif (is_array($cot_translit)) {
            $title = strtr($title, $cot_translit);
        }
    }
    $title = preg_replace('#[^\\p{L}0-9\\-_ ]#u', '', $title);
    $title = str_replace(' ', $cfg['plugin']['autoalias2']['sep'], $title);
    if ($cfg['plugin']['autoalias2']['lowercase']) {
        $title = mb_strtolower($title);
    }
    if ($cfg['plugin']['autoalias2']['prepend_id'] && !empty($id)) {
        $title = $id . $cfg['plugin']['autoalias2']['sep'] . $title;
    } elseif ($duplicate) {
        switch ($cfg['plugin']['autoalias2']['on_duplicate']) {
            case 'ID':
                if (!empty($id)) {
                    $title .= $cfg['plugin']['autoalias2']['sep'] . $id;
                    break;
                }
            default:
                $title .= $cfg['plugin']['autoalias2']['sep'] . rand(2, 99);
                break;
        }
    }
    return $title;
}
コード例 #8
0
 public function append(PredictionException $exception)
 {
     $message = $exception->getMessage();
     $message = '  ' . strtr($message, array("\n" => "\n  ")) . "\n";
     $this->message = rtrim($this->message . $message);
     $this->exceptions[] = $exception;
 }
コード例 #9
0
 /**
  * Iterate over all files in the given directory searching for classes
  *
  * @param \Iterator|string $path      The path to search in or an iterator
  * @param string           $blacklist Regex that matches against the file path that exclude from the classmap.
  * @param IOInterface      $io        IO object
  * @param string           $namespace Optional namespace prefix to filter by
  *
  * @throws \RuntimeException When the path is neither an existing file nor directory
  * @return array             A class map array
  */
 public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
 {
     if (is_string($path)) {
         if (is_file($path)) {
             $path = array(new \SplFileInfo($path));
         } elseif (is_dir($path)) {
             $path = Finder::create()->files()->followLinks()->name('/\\.(php|inc|hh)$/')->in($path);
         } else {
             throw new \RuntimeException('Could not scan for classes inside "' . $path . '" which does not appear to be a file nor a folder');
         }
     }
     $map = array();
     foreach ($path as $file) {
         $filePath = $file->getRealPath();
         if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
             continue;
         }
         if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
             continue;
         }
         $classes = self::findClasses($filePath);
         foreach ($classes as $class) {
             // skip classes not within the given namespace prefix
             if (null !== $namespace && 0 !== strpos($class, $namespace)) {
                 continue;
             }
             if (!isset($map[$class])) {
                 $map[$class] = $filePath;
             } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class] . ' ' . $filePath, '\\', '/'))) {
                 $io->writeError('<warning>Warning: Ambiguous class resolution, "' . $class . '"' . ' was found in both "' . $map[$class] . '" and "' . $filePath . '", the first will be used.</warning>');
             }
         }
     }
     return $map;
 }
コード例 #10
0
 function streamData($data, $name, $time = 0, $level = -1)
 {
     $time = $this->dosTime($time);
     $crc = crc32($data);
     $dlen = strlen($data);
     $level < 0 && ($level = (int) $this->level);
     $level < 0 && ($level = self::LEVEL);
     $data = gzdeflate($data, $level);
     $zlen = strlen($data);
     $name = strtr($name, '\\', '/');
     $n = @iconv('UTF-8', 'CP850', $name);
     // If CP850 can not represent the filename, use unicode
     if ($name !== @iconv('CP850', 'UTF-8', $n)) {
         $n = $name;
         $h = "";
     } else {
         $h = "";
     }
     $nlen = strlen($n);
     $h = "" . $h . "" . pack('V', $time) . pack('V', $crc) . pack('V', $zlen) . pack('V', $dlen) . pack('v', $nlen) . pack('v', 0);
     // extra field length
     echo "PK", $h, $n, $data;
     $dlen = $this->dataLen;
     $this->dataLen += 4 + strlen($h) + $nlen + $zlen;
     $this->cdr[] = "PK" . "" . $h . pack('v', 0) . pack('v', 0) . pack('v', 0) . pack('V', 32) . pack('V', $dlen) . $n;
 }
コード例 #11
0
function get_pager_controls($pager)
{
    $route = url_for(sfContext::getInstance()->getRouting()->getCurrentInternalUri(true));
    if ($pager->getNbResults()) {
        $template = "<div class='pagination'>\n                    <span>Results <em>%first%-%last%<em> of <em>%total%<em></span>\n                    %pagination%\n                 </div>";
        $pagination = "";
        if ($pager->haveToPaginate()) {
            $pagination = "<ul>";
            // Previous
            if ($pager->getPage() != $pager->getFirstPage()) {
                $pagination .= "<li><a href='" . $route . "?page=1'>&lt;&lt;</a></li>";
                $pagination .= "<li><a href='" . $route . "?page=" . $pager->getPreviousPage() . "'>Previous</a></li>";
            }
            // In between
            foreach ($pager->getLinks() as $page) {
                if ($page == $pager->getPage()) {
                    $pagination .= "<li>{$page}</li>";
                } else {
                    $pagination .= "<li><a href='{$route}?page={$page}'>{$page}</a></li>";
                }
            }
            // Next
            if ($pager->getPage() != $pager->getLastPage()) {
                $pagination .= "<li><a href='{$route}?page=" . $pager->getNextPage() . "'>Next</a></li>";
                $pagination .= "<li><a href='{$route}?page=" . $pager->getLastPage() . "'>&gt;&gt;</a></li>";
            }
            $pagination .= "</ul>";
        }
        return strtr($template, array('%first%' => $pager->getFirstIndice(), '%last%' => $pager->getLastIndice(), '%total%' => $pager->getNbResults(), '%pagination%' => $pagination));
    }
}
コード例 #12
0
 /**
  * @pre: isModelPackage($package)
  */
 public static function getModelPath($package)
 {
     //return "./apps/$app/model";
     //return "./apps/". strtr($package, ".", "/"); // Correccion para poder poner subdirectorios en /model.
     return "apps/" . strtr($package, ".", "/");
     // Correccion para poder poner subdirectorios en /model.
 }
コード例 #13
0
 private function getExpectedFile($forFile)
 {
     $name = basename($forFile);
     $name = strtr($name, '.', '_');
     $file = __DIR__ . '/Expectations/' . $name . '.out';
     return $file;
 }
コード例 #14
0
    private function addPluginDefinition($replace)
    {
        $lines = <<<EOF
  // These settings control where the widget appears in the Panels "Add New Content" menu.
  'title' => '{{title}}',
  'description' => '{{description}}',
  'category' => array('{{category}}', 0),
  'icon' => '{{name}}.png',

  //  'required context' => array(
  //    new ctools_context_required(t('Node'), 'node'),
  //  ),

  'render callback' => 'tdm_widgets_{{name}}_render',
  'edit form' => 'tdm_widgets_{{name}}_edit_form',
  'admin info' => 'tdm_widgets_{{name}}_admin_info',

  // default data for configuration
  'defaults' => array(
    'setting_1' => 'Default Value',
  ),

  'tdm admin css' => '{{name}}_admin.css',
  'tdm admin js' => '{{name}}_admin.js',

  // 'single' means not to be sub-typed
  'single' => TRUE,
EOF;
        return strtr($lines, $replace);
    }
コード例 #15
0
function scrambleEmail($email, $method='unicode')
{
	switch ($method) {
	case 'strtr':
		$trans = array(	"@" => tra("(AT)"),
						"." => tra("(DOT)")
		);
		return strtr($email, $trans);
	case 'x' :
		$encoded = $email;
		for ($i = strpos($email, "@") + 1, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) {
			if ($encoded[$i]  != ".") $encoded[$i] = 'x';
		}
		return $encoded;
	case 'unicode':
	case 'y':// for previous compatibility
		$encoded = '';
		for ($i = 0, $istrlen_email = strlen($email); $i < $istrlen_email; $i++) {
			$encoded .= '&#' . ord($email[$i]). ';';
		}
		return $encoded;
	case 'n':
	default:
		return $email;
	}
}
コード例 #16
0
ファイル: helper.php プロジェクト: phuongitvn/vdh
 public static function makeFriendlyUrl($string, $allowUnder = false, $sep = '-')
 {
     static $charMap = array("à" => "a", "ả" => "a", "ã" => "a", "á" => "a", "ạ" => "a", "ă" => "a", "ằ" => "a", "ẳ" => "a", "ẵ" => "a", "ắ" => "a", "ặ" => "a", "â" => "a", "ầ" => "a", "ẩ" => "a", "ẫ" => "a", "ấ" => "a", "ậ" => "a", "đ" => "d", "è" => "e", "ẻ" => "e", "ẽ" => "e", "é" => "e", "ẹ" => "e", "ê" => "e", "ề" => "e", "ể" => "e", "ễ" => "e", "ế" => "e", "ệ" => "e", "ì" => 'i', "ỉ" => 'i', "ĩ" => 'i', "í" => 'i', "ị" => 'i', "ò" => 'o', "ỏ" => 'o', "õ" => "o", "ó" => "o", "ọ" => "o", "ô" => "o", "ồ" => "o", "ổ" => "o", "ỗ" => "o", "ố" => "o", "ộ" => "o", "ơ" => "o", "ờ" => "o", "ở" => "o", "ỡ" => "o", "ớ" => "o", "ợ" => "o", "ù" => "u", "ủ" => "u", "ũ" => "u", "ú" => "u", "ụ" => "u", "ư" => "u", "ừ" => "u", "ử" => "u", "ữ" => "u", "ứ" => "u", "ự" => "u", "ỳ" => "y", "ỷ" => "y", "ỹ" => "y", "ý" => "y", "ỵ" => "y", "À" => "A", "Ả" => "A", "Ã" => "A", "Á" => "A", "Ạ" => "A", "Ă" => "A", "Ằ" => "A", "Ẳ" => "A", "Ẵ" => "A", "Ắ" => "A", "Ặ" => "A", "Â" => "A", "Ầ" => "A", "Ẩ" => "A", "Ẫ" => "A", "Ấ" => "A", "Ậ" => "A", "Đ" => "D", "È" => "E", "Ẻ" => "E", "Ẽ" => "E", "É" => "E", "Ẹ" => "E", "Ê" => "E", "Ề" => "E", "Ể" => "E", "Ễ" => "E", "Ế" => "E", "Ệ" => "E", "Ì" => "I", "Ỉ" => "I", "Ĩ" => "I", "Í" => "I", "Ị" => "I", "Ò" => "O", "Ỏ" => "O", "Õ" => "O", "Ó" => "O", "Ọ" => "O", "Ô" => "O", "Ồ" => "O", "Ổ" => "O", "Ỗ" => "O", "Ố" => "O", "Ộ" => "O", "Ơ" => "O", "Ờ" => "O", "Ở" => "O", "Ỡ" => "O", "Ớ" => "O", "Ợ" => "O", "Ù" => "U", "Ủ" => "U", "Ũ" => "U", "Ú" => "U", "Ụ" => "U", "Ư" => "U", "Ừ" => "U", "Ử" => "U", "Ữ" => "U", "Ứ" => "U", "Ự" => "U", "Ỳ" => "Y", "Ỷ" => "Y", "Ỹ" => "Y", "Ý" => "Y", "Ỵ" => "Y");
     $string = strtr($string, $charMap);
     $string = self::CleanUpSpecialChars($string, $allowUnder, $sep);
     return strtolower($string);
 }
コード例 #17
0
 public function run()
 {
     echo Html::beginTag('div', ['class' => 'input-group']);
     if (!isset($this->options['class'])) {
         $this->options['class'] = 'form-control';
     }
     $iconId = 'icon-' . $this->options['id'];
     if (!isset($this->options['aria-describedby'])) {
         $this->options['aria-describedby'] = $iconId;
     }
     if ($this->hasModel()) {
         $replace['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->options);
     } else {
         $replace['{input}'] = Html::textInput($this->name, $this->value, $this->options);
     }
     if ($this->icon != '') {
         $replace['{icon}'] = Html::tag('span', Icon::show($this->icon, [], Icon::FA), ['class' => 'input-group-addon', 'id' => $iconId]);
     }
     echo strtr($this->template, $replace);
     echo Html::endTag('div');
     $view = $this->getView();
     Assets::register($view);
     $idMaster = $this->hasModel() ? Html::getInputId($this->model, $this->fromField) : $this->fromField;
     $idSlave = $this->options['id'];
     $view->registerJs("\n        \$('#{$idMaster}').syncTranslit({\n            destination: '{$idSlave}',\n            type: 'url',\n            caseStyle: 'lower',\n            urlSeparator: '-'\n        });");
 }
コード例 #18
0
ファイル: files.php プロジェクト: kosmosby/medicine-prof
	public function iteratorFilter($path)
	{
        $state     = $this->getState();
		$filename  = ltrim(basename(' '.strtr($path, array('/' => '/ '))));
		$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));

		if ($state->name)
        {
			if (!in_array($filename, (array) $state->name)) {
				return false;
			}
		}

		if ($state->types)
        {
			if ((in_array($extension, ComFilesModelEntityFile::$image_extensions) && !in_array('image', (array) $state->types))
			|| (!in_array($extension, ComFilesModelEntityFile::$image_extensions) && !in_array('file', (array) $state->types))
			) {
				return false;
			}
		}

		if ($state->search && stripos($filename, $state->search) === false) {
            return false;
        }
	}
コード例 #19
0
/**
 * Prints one ore more errormessages on screen
 *
 * @param array Errormessages
 * @param string A %s in the errormessage will be replaced by this string.
 * @author Florian Lippert <*****@*****.**>
 * @author Ron Brand <*****@*****.**>
 */
function standard_error($errors = '', $replacer = '')
{
    global $userinfo, $s, $header, $footer, $lng, $theme;
    $_SESSION['requestData'] = $_POST;
    $replacer = htmlentities($replacer);
    if (!is_array($errors)) {
        $errors = array($errors);
    }
    $link = '';
    if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']) !== false) {
        $link = '<a href="' . htmlentities($_SERVER['HTTP_REFERER']) . '">' . $lng['panel']['back'] . '</a>';
    }
    $error = '';
    foreach ($errors as $single_error) {
        if (isset($lng['error'][$single_error])) {
            $single_error = $lng['error'][$single_error];
            $single_error = strtr($single_error, array('%s' => $replacer));
        } else {
            $error = 'Unknown Error (' . $single_error . '): ' . $replacer;
            break;
        }
        if (empty($error)) {
            $error = $single_error;
        } else {
            $error .= ' ' . $single_error;
        }
    }
    eval("echo \"" . getTemplate('misc/error', '1') . "\";");
    exit;
}
コード例 #20
0
ファイル: path.php プロジェクト: dalinhuang/zotop
 public static function decode($path)
 {
     $p = array('$system' => ZOTOP_PATH_SYSTEM, '$modules' => ZOTOP_PATH_MODULES);
     $path = strtr($path, $p);
     $path = path::clean($path);
     return $path;
 }
コード例 #21
0
ファイル: Menu.php プロジェクト: WittayaSi/yii2-tak
 /**
  * Recursively renders the menu items (without the container tag).
  * @param array $items the menu items to be rendered recursively
  * @return string the rendering result
  */
 protected function renderItems($items)
 {
     $n = count($items);
     $lines = [];
     foreach ($items as $i => $item) {
         $options = array_merge($this->itemOptions, ArrayHelper::getValue($item, 'options', []));
         $tag = ArrayHelper::remove($options, 'tag', 'li');
         $class = [];
         if ($item['active']) {
             $class[] = $this->activeCssClass;
         }
         if ($i === 0 && $this->firstItemCssClass !== null) {
             $class[] = $this->firstItemCssClass;
         }
         if ($i === $n - 1 && $this->lastItemCssClass !== null) {
             $class[] = $this->lastItemCssClass;
         }
         if (!empty($class)) {
             if (empty($options['class'])) {
                 $options['class'] = implode(' ', $class);
             } else {
                 $options['class'] .= ' ' . implode(' ', $class);
             }
         }
         $menu = $this->renderItem($item);
         if (!empty($item['items'])) {
             $menu .= strtr($this->submenuTemplate, ['{show}' => $item['active'] ? "style='display: block'" : '', '{items}' => $this->renderItems($item['items'])]);
         }
         $lines[] = Html::tag($tag, $menu, $options);
     }
     return implode("\n", $lines);
 }
コード例 #22
0
 public function __construct($text)
 {
     $this->text = $text;
     $text = (string) $text;
     // преобразуем в строковое значение
     $text = strip_tags($text);
     // убираем HTML-теги
     $text = str_replace(array("\n", "\r"), " ", $text);
     // убираем перевод каретки
     $text = preg_replace("/\\s+/", ' ', $text);
     // удаляем повторяющие пробелы
     $text = trim($text);
     // убираем пробелы в начале и конце строки
     $text = mb_strtolower($text, 'utf-8');
     // переводим строку в нижний регистр
     $text = strtr($text, array('а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'ж' => 'j', 'з' => 'z', 'и' => 'y', 'і' => 'i', 'ї' => 'і', 'й' => 'y', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ы' => 'y', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'ъ' => '', 'ь' => ''));
     // в данном случае язык
     //будет укр.(изначально скрипт для русского яз.) поэтому некоторые буквы заменены или удалены, а именно ('и'=>'i')
     $text = preg_replace("/[^0-9a-z-_ ]/i", "", $text);
     // очищаем строку от недопустимых символов
     $text = str_replace(" ", "_", $text);
     // заменяем пробелы нижним подчеркиванием
     $text = str_replace("-", "_", $text);
     //заменяет минус на нижнее подчеркивание
     $this->translit = $text;
 }
コード例 #23
0
ファイル: FileCache.php プロジェクト: aelmasry/ClinicSoft
 /**
  * {@inheritDoc}
  */
 public function evictClassMetadataFromCache(\ReflectionClass $class)
 {
     $path = $this->dir . '/' . strtr($class->name, '\\', '-') . '.cache.php';
     if (file_exists($path)) {
         unlink($path);
     }
 }
コード例 #24
0
ファイル: tipask.class.php プロジェクト: eappl/prototype
 function init_request()
 {
     require TIPASK_ROOT . '/config.php';
     header('Content-type: text/html; charset=' . TIPASK_CHARSET);
     //给浏览器识别,sbie6
     $querystring = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '';
     $pos = strpos($querystring, '.');
     if ($pos !== false) {
         $querystring = substr($querystring, 0, $pos);
     }
     $andpos = strpos($querystring, "&");
     $andpos && ($querystring = substr($querystring, 0, $andpos));
     $this->get = explode('/', $querystring);
     if (empty($this->get[0])) {
         $curPageURL = curPageURL();
         $curPageURL = strtr($curPageURL, array('http://' => '', '/' => ''));
         if ($curPageURL == config::ADMIN_DOMAIN) {
             $this->get[0] = 'admin_main';
         } else {
             $this->get[0] = 'index';
         }
     }
     if (empty($this->get[1])) {
         $this->get[1] = 'default';
     }
     if (count($this->get) < 2) {
         exit(' Access Denied !');
     }
     unset($GLOBALS, $_ENV, $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_ENV_VARS);
     $this->get = taddslashes($this->get, 1);
     $this->post = taddslashes(array_merge($_GET, $_POST));
     unset($_POST);
 }
コード例 #25
0
ファイル: Mail.php プロジェクト: ashmna/MedDocs
 public static function syncDictionaryItem(\PHPMailer $mail, $keyName, $lang = '', array $params = [])
 {
     $app = App::getInstance();
     /** @var \MD\DAO\Dictionary $dictionaryDAO */
     $dictionaryDAO = $app->container->get('MD\\DAO\\Dictionary');
     $config = Config::getInstance();
     if (empty($lang)) {
         $lang = $config->currentLocale;
     }
     $params['name'] = $config->partnerName;
     $params['url'] = $config->getPartnerSiteUrl();
     $params['affiliateUrl'] = $config->partnerUrl;
     $params1 = [];
     foreach ($params as $key => $value) {
         $params1['{' . $key . '}'] = $value;
     }
     $params = $params1;
     $dictionary = $dictionaryDAO->getDictionaryItem($keyName, $lang);
     if (isset($dictionary)) {
         $mail->isHTML(true);
         $mail->Subject = strtr($dictionary->title, $params);
         $mail->Body = strtr($dictionary->content, $params);
     }
     return $mail;
 }
コード例 #26
0
ファイル: Thread.php プロジェクト: DSNS-LAB/Dmail
 /**
  */
 public function __get($name)
 {
     switch ($name) {
         case 'reverse_img':
         case 'reverse_raw':
             $ret = strtr($this->_data, array(self::JOINBOTTOM_DOWN => self::JOINBOTTOM, self::JOINBOTTOM => self::JOINBOTTOM_DOWN));
             break;
         default:
             $ret = $this->_data;
             break;
     }
     switch ($name) {
         case 'img':
         case 'reverse_img':
             $tmp = '';
             if (strlen($ret)) {
                 foreach (str_split($ret) as $val) {
                     $tmp .= '<span class="horde-tree-image horde-tree-image-' . $val . '"></span>';
                 }
             }
             return $tmp;
         case 'raw':
         case 'reverse_raw':
             return $ret;
     }
 }
コード例 #27
0
function chmodnum($chmod)
{
    $trans = array('-' => '0', 'r' => '4', 'w' => '2', 'x' => '1');
    $chmod = substr(strtr($chmod, $trans), 1);
    $array = str_split($chmod, 3);
    return array_sum(str_split($array[0])) . array_sum(str_split($array[1])) . array_sum(str_split($array[2]));
}
コード例 #28
0
 public static function base64_decode($string = null)
 {
     if (!is_string($string)) {
         return null;
     }
     return base64_decode(strtr($string, '-_,', '+/='));
 }
コード例 #29
0
 /**
  * Sends an error message to the collector for later use
  * @param $line Integer line number, or HTMLPurifier_Token that caused error
  * @param $severity int Error severity, PHP error style (don't use E_USER_)
  * @param $msg string Error message text
  */
 function send($severity, $msg)
 {
     $args = array();
     if (func_num_args() > 2) {
         $args = func_get_args();
         array_shift($args);
         unset($args[0]);
     }
     $token = $this->context->get('CurrentToken', true);
     $line = $token ? $token->line : $this->context->get('CurrentLine', true);
     $attr = $this->context->get('CurrentAttr', true);
     // perform special substitutions, also add custom parameters
     $subst = array();
     if (!is_null($token)) {
         $args['CurrentToken'] = $token;
     }
     if (!is_null($attr)) {
         $subst['$CurrentAttr.Name'] = $attr;
         if (isset($token->attr[$attr])) {
             $subst['$CurrentAttr.Value'] = $token->attr[$attr];
         }
     }
     if (empty($args)) {
         $msg = $this->locale->getMessage($msg);
     } else {
         $msg = $this->locale->formatMessage($msg, $args);
     }
     if (!empty($subst)) {
         $msg = strtr($msg, $subst);
     }
     $this->errors[] = array($line, $severity, $msg);
 }
コード例 #30
-1
 function setAppConfig($approval = 'auto')
 {
     $this->client = new Google_Client();
     /* Set Retries */
     $this->client->setClassConfig('Google_Task_Runner', 'retries', 5);
     $this->userInfoService = new Google_Service_Oauth2($this->client);
     $this->googleDriveService = new Google_Service_Drive($this->client);
     $this->googleUrlshortenerService = new Google_Service_Urlshortener($this->client);
     if (!empty($this->settings['googledrive_app_client_id']) && !empty($this->settings['googledrive_app_client_secret'])) {
         $this->client->setClientId($this->settings['googledrive_app_client_id']);
         $this->client->setClientSecret($this->settings['googledrive_app_client_secret']);
     } else {
         $this->client->setClientId('538839470620-fvjmtsvik53h255bnu0qjmbr8kvd923i.apps.googleusercontent.com');
         $this->client->setClientSecret('UZ1I3I-D4rPhXpnE8T1ggGhE');
     }
     $this->client->setRedirectUri('http://www.florisdeleeuw.nl/use-your-drive/index.php');
     $this->client->setApprovalPrompt($approval);
     $this->client->setAccessType('offline');
     $this->client->setScopes(array('https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/urlshortener'));
     $page = isset($_GET["page"]) ? '?page=' . $_GET["page"] : '';
     $location = get_admin_url(null, 'admin.php' . $page);
     $this->client->setState(strtr(base64_encode($location), '+/=', '-_~'));
     /* Logger */
     $this->client->setClassConfig('Google_Logger_File', array('file' => USEYOURDRIVE_CACHEDIR . '/log', 'mode' => 0640, 'lock' => true));
     $this->client->setClassConfig('Google_Logger_Abstract', array('level' => 'debug', 'log_format' => "[%datetime%] %level%: %message% %context%\n", 'date_format' => 'd/M/Y:H:i:s O', 'allow_newlines' => true));
     /* Uncomment the following line to log communcations.
      * The log is located in /cache/log
      */
     //$this->client->setLogger(new Google_Logger_File($this->client));
     return true;
 }