本文整理汇总了PHP中RevSliderFunctions::trimArrayItems方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctions::trimArrayItems方法的具体用法?PHP RevSliderFunctions::trimArrayItems怎么用?PHP RevSliderFunctions::trimArrayItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderFunctions
的用法示例。
在下文中一共展示了RevSliderFunctions::trimArrayItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUpdateSliderFromOptions
/**
*
* create / update slider from options
*/
private function createUpdateSliderFromOptions($options, $sliderID = null)
{
$arrMain = RevSliderFunctions::getVal($options, "main");
$params = RevSliderFunctions::getVal($options, "params");
//trim all input data
$arrMain = RevSliderFunctions::trimArrayItems($arrMain);
$params = RevSliderFunctions::trimArrayItems($params);
$params = array_merge($arrMain, $params);
$title = RevSliderFunctions::getVal($arrMain, "title");
$alias = RevSliderFunctions::getVal($arrMain, "alias");
if (!empty($sliderID)) {
$this->initByID($sliderID);
}
$this->validateInputSettings($title, $alias, $params);
$jsonParams = json_encode($params);
//insert slider to database
$arrData = array();
$arrData["title"] = $title;
$arrData["alias"] = $alias;
$arrData["params"] = $jsonParams;
if (empty($sliderID)) {
//create slider
$arrData['settings'] = json_encode(array('version' => 5.0));
$sliderID = $this->db->insert(RevSliderGlobals::$table_sliders, $arrData);
return $sliderID;
} else {
//update slider
$this->initByID($sliderID);
$settings = $this->getSettings();
$settings['version'] = 5.0;
$arrData['settings'] = json_encode($settings);
$sliderID = $this->db->update(RevSliderGlobals::$table_sliders, $arrData, array("id" => $sliderID));
}
}
示例2: createUpdateSliderFromOptions
/**
*
* create / update slider from options
*/
private function createUpdateSliderFromOptions($options, $sliderID = null)
{
$arrMain = RevSliderFunctions::getVal($options, "main");
$params = RevSliderFunctions::getVal($options, "params");
//trim all input data
$arrMain = RevSliderFunctions::trimArrayItems($arrMain);
$params = RevSliderFunctions::trimArrayItems($params);
$params = array_merge($arrMain, $params);
$title = sanitize_text_field(RevSliderFunctions::getVal($arrMain, "title"));
$alias = sanitize_text_field(RevSliderFunctions::getVal($arrMain, "alias"));
//params css and js check
if (!RevSliderFunctionsWP::isAdminUser() && apply_filters('revslider_restrict_role', true)) {
//dont allow css and javascript from users other than administrator
unset($params['custom_css']);
unset($params['custom_javascript']);
}
if (!empty($sliderID)) {
$this->initByID($sliderID);
if (!RevSliderFunctionsWP::isAdminUser() && apply_filters('revslider_restrict_role', true)) {
//check for js and css, add it to $params
$params['custom_css'] = $this->getParam('custom_css', '');
$params['custom_javascript'] = $this->getParam('custom_javascript', '');
}
}
$this->validateInputSettings($title, $alias, $params);
$jsonParams = json_encode($params);
//insert slider to database
$arrData = array();
$arrData["title"] = $title;
$arrData["alias"] = $alias;
$arrData["params"] = $jsonParams;
$arrData["type"] = '';
if (empty($sliderID)) {
//create slider
$arrData['settings'] = json_encode(array('version' => 5.0));
$sliderID = $this->db->insert(RevSliderGlobals::$table_sliders, $arrData);
return $sliderID;
} else {
//update slider
$this->initByID($sliderID);
$settings = $this->getSettings();
$settings['version'] = 5.0;
$arrData['settings'] = json_encode($settings);
$sliderID = $this->db->update(RevSliderGlobals::$table_sliders, $arrData, array("id" => $sliderID));
}
}