本文整理汇总了PHP中Sintattica\Atk\Core\Tools::decodeKeyValuePair方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::decodeKeyValuePair方法的具体用法?PHP Tools::decodeKeyValuePair怎么用?PHP Tools::decodeKeyValuePair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sintattica\Atk\Core\Tools
的用法示例。
在下文中一共展示了Tools::decodeKeyValuePair方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRowKeyFromSelector
/**
* Get rowkey from an ATK/SQL selector.
*
* We sneak rowkeys in the selectors as negative ids.
*
* @param string $selector
*
* @return mixed Key in negative int form or false if we failed to get the key
*/
private static function getRowKeyFromSelector($selector)
{
$selector = Tools::decodeKeyValuePair($selector);
$selector_values = array_values($selector);
if (count($selector_values) === 1 && is_numeric($selector_values[0]) && $selector_values[0] <= 0) {
return -1 * $selector_values[0];
}
return false;
}
示例2: deleteDb
/**
* This function overrides the deleteDb function to delete a file
* from the selected directory.
*
* @param string $selector The identifier of the file that should be deleted
*
* @return bool The result of the file deletion
*/
public function deleteDb($selector)
{
$sessmngr = SessionManager::getInstance();
$this->m_dir = $this->stripDir($sessmngr->stackVar('dirname'));
$decodedselector = Tools::decodeKeyValuePair($selector);
$filename = $decodedselector['dummy.filename'];
Tools::atk_var_dump($this->m_dir, 'm_dir');
Tools::atk_var_dump($filename, 'filename');
if (strpos($filename, '..') === false) {
unlink($this->m_dir . $filename);
Tools::atkdebug('Deleted ' . $this->m_dir . $filename);
} else {
Tools::atkerror('Cannot unlink relative files. Possible hack attempt detected!');
}
return true;
}