本文整理汇总了PHP中JFolder::makesafe方法的典型用法代码示例。如果您正苦于以下问题:PHP JFolder::makesafe方法的具体用法?PHP JFolder::makesafe怎么用?PHP JFolder::makesafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFolder
的用法示例。
在下文中一共展示了JFolder::makesafe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSportsType
/**
* Method to add a new sportstype if not already exists
*
* @access private
* @return boolean True on success
**/
function addSportsType($newSportsTypeName)
{
$path = JPATH::clean(JPATH_ROOT . '/images/com_joomleague/database/events/' . JFolder::makesafe($newSportsTypeName));
if (!JFolder::exists($path)) {
JFolder::create($path);
}
// SportsType does NOT exist and has to be created
$tblSportsType = $this->getTable();
$tblSportsType->load(array('name' => $newSportsTypeName));
$tblSportsType->name = $newSportsTypeName;
$tblSportsType->store();
return $tblSportsType->id;
}
示例2: addSportsType
/**
* Method to add a new sportstype if not already exists
*
* @access private
* @return boolean True on success
* @since 1.5
**/
function addSportsType($newsportstype)
{
//check if sportstype exists. If not add a new sportstype to table
$query = "SELECT * FROM #__joomleague_sport_type WHERE name=" . $this->_db->Quote($newsportstype);
$this->_db->setQuery($query);
$sportstypeObject = $this->_db->loadObject();
if ($sportstypeObject->id) {
//sportstype already exists
return $sportstypeObject->id;
}
JFolder::create(JPATH::clean(JPATH_ROOT . '/images/com_joomleague/database/events/' . JFolder::makesafe($name)));
//sportstype does NOT exist and has to be created
$p_sportstype =& $this->getTable();
$p_sportstype->set('name', $newsportstype);
if (!$p_sportstype->store()) {
$sportstypeObject->id = 0;
} else {
$sportstypeObject->id = $this->_db->insertid();
//mysql_insert_id();
}
return $sportstypeObject->id;
}