/** * Translate a gettext key and interpolate variables. * * @param string $key - translation key, e.g. "hello ${username}!" * @param string $htmlescape - if true, you should HTML-escape translated string. You should never HTML-escape interpolated variables. */ function translate($key, $htmlescape = true) { $value = $this->context[$key]; if ($htmlescape) { $value = htmlspecialchars($value, ENT_COMPAT | ENT_HTML401, $this->encoding); } while (preg_match('/\\${(.*?)\\}/sm', $value, $matches)) { list($source, $field) = $matches; if (!array_keys_exists($field, $this->context)) { throw new \Exception(sprintf('Interpolation error, variable "%s" not set', $field)); } $value = str_replace($source, $this->context[$var], $value); } return $value; }
public function object($name) { // Check if name is a string, array or object. if (is_array($name) || is_object($name)) { $name = implode("->", (array) $name); } if (!is_string($name)) { throw new Exception(__METHOD__ . "(): \$name must be a string."); } $params = func_get_args(); if (array_keys_exists(1, $params) && $params[1] === null) { // Delete $request = $this->api(OAuth2::DELETE, "/user/me/storage", array("name" => $name)); $request->execute(); $response = $request->responseObject(); if (isset($response->success) && $response->success == true) { return true; } else { return false; } } elseif (array_keys_exists(1, $params)) { // Set $request = $this->api(OAuth2::POST, "/user/me/storage", array("name" => $name, "value" => json_encode($value))); $request->execute(); $response = $request->responseObject(); if (isset($response->success) && $response->success == true) { return true; } else { return false; } } else { // Get $request = $this->api(OAuth2::GET, "/user/me/storage", array("name" => $name)); $request->execute(); $response = $request->responseObject(); if (isset($request->error)) { return false; } $object = new stdClass(); $object->name = isset($response->name) ? $response->name : $name; $object->value = isset($response->value) ? is_object($value_decoded = json_decode($response->value)) ? $value_decoded : $response->value : null; $object->date = isset($response->lastupdated) ? $response->lastupdated : null; $object->time = isset($response->lastupdated) ? strtotime($response->lastupdated) : null; $object->response = $response; return $object; } }
<th>Скрипты</th> </tr> <?php if (array_keys_exists(array('relations', 'modules'), $application) && is_array($application['relations']['modules'])) { ?> <?php foreach ($application['updates'] as $update) { ?> <tr> <td><?php echo CHtml::encode($update['version']); ?> </td> <td> <?php if (array_keys_exists(array('database', 'import'), $update) && is_array($update['database']['import'])) { ?> <ul> <?php foreach ($update['database']['import'] as $file) { ?> <li><?php echo CHtml::encode($file); ?> </li> <?php } ?> </ul> <?php }
* it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * OpenMediaVault is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>. */ require_once "openmediavault/autoloader.inc"; require_once "openmediavault/env.inc"; require_once "openmediavault/functions.inc"; if (array_keys_exists(array("service", "method"), $_POST)) { try { function exception_error_handler($errno, $errstr, $errfile, $errline) { switch ($errno) { case E_STRICT: break; default: throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); break; } } set_error_handler("exception_error_handler"); require_once "openmediavault/config.inc"; // Must be included here $session =& \OMV\Session::getInstance();
function &getAttribute($attname) { if (array_keys_exists($attname, $this->attributes)) { return $this->attributes[$attname]; } }
/** * Fabrik 3 - needs to be onAjax_upload not ajax_upload * triggered by plupload widget */ public function onAjax_upload() { //got this warning on fabrikar.com - not sure why set testing with errors off /* * <b>Warning</b>: utf8_to_unicode: Illegal sequence identifier in UTF-8 at byte 0 in <b>/home/fabrikar/public_html/downloads/libraries/phputf8/utils/unicode.php</b> on line <b>110</b><br /> */ error_reporting(0); error_reporting(E_ERROR | E_PARSE); $this->_id = JRequest::getInt('element_id'); $groupModel = $this->getGroup(); $isjoin = $groupModel->isJoin(); if ($isjoin) { $name = $this->getFullName(false, true, false); $joinid = $groupModel->getGroup()->join_id; } else { $name = $this->getFullName(true, true, false); } // Get parameters $chunk = JRequest::getInt('chunk', 0); $chunks = JRequest::getInt('chunks', 0); $fileName = JRequest::getVar('name', ''); if ($chunk + 1 < $chunks) { return; } require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'uploader.php'; //@TODO test in join $o = new stdClass(); if (array_key_exists('file', $_FILES) || array_keys_exists('join', $_FILES)) { $file = array('name' => $isjoin ? $_FILES['join']['name'][$joinid] : $_FILES['file']['name'], 'type' => $isjoin ? $_FILES['join']['type'][$joinid] : $_FILES['file']['type'], 'tmp_name' => $isjoin ? $_FILES['join']['tmp_name'][$joinid] : $_FILES['file']['tmp_name'], 'error' => $isjoin ? $_FILES['join']['error'][$joinid] : $_FILES['file']['error'], 'size' => $isjoin ? $_FILES['join']['size'][$joinid] : $_FILES['file']['size']); $filepath = $this->_processIndUpload($file, '', 0); $uri = $this->getStorage()->pathToURL($filepath); $o->filepath = $filepath; $o->uri = $uri; } else { $o->filepath = null; $o->uri = null; } echo json_encode($o); return; }
/** * Whether a offset exists * * @param mixed An offset to check for. * @return boolean TRUE on success or FALSE on failure. */ public function offsetExists($offset) { return array_keys_exists($offset, $this->data); }