本文整理匯總了PHP中Arr::unique方法的典型用法代碼示例。如果您正苦於以下問題:PHP Arr::unique方法的具體用法?PHP Arr::unique怎麽用?PHP Arr::unique使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Arr
的用法示例。
在下文中一共展示了Arr::unique方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _init
/**
* Class init
*
* Fetches CSRF settings and current token
*
* @throws SecurityException it the CSRF token validation failed
* @throws FuelException if no security output filter is defined
*/
public static function _init()
{
static::$csrf_token_key = \Config::get('security.csrf_token_key', 'fuel_csrf_token');
static::$csrf_old_token = \Input::cookie(static::$csrf_token_key, false);
// if csrf automatic checking is enabled, and it fails validation, bail out!
if (\Config::get('security.csrf_autoload', true)) {
$check_token_methods = \Config::get('security.csrf_autoload_methods', array('post', 'put', 'delete'));
if (in_array(strtolower(\Input::method()), $check_token_methods) and !static::check_token()) {
throw new \SecurityException('CSRF validation failed, Possible hacking attempt detected!');
}
}
// throw an exception if the output filter setting is missing from the app config
if (\Config::get('security.output_filter', null) === null) {
throw new \FuelException('There is no security.output_filter defined in your application config file');
}
// deal with duplicate filters, no need to slow the framework down
foreach (array('output_filter', 'uri_filter', 'input_filter') as $setting) {
$config = \Config::get('security.' . $setting, array());
is_array($config) and \Config::set('security.' . $setting, \Arr::unique($config));
}
}
示例2: hookGetMultisiteTables
/**
* hook plugin to get multisite tables names.<br>
* this will get module's tables that need to be copy while create new site.<br>
* attention! you must call this method everytime when you want to access multisite tables list.
*
* @todo [fuelstart][multisite][plug] get module's multisite tables plug.
*/
public function hookGetMultisiteTables()
{
$plugin = new \Library\Plugins();
if ($plugin->hasFilter('SitesGetModulesMultisiteTables') !== false) {
$plugin->doFilter('SitesGetModulesMultisiteTables');
if (is_array($plugin->original_data) && !empty($plugin->original_data)) {
foreach ($plugin->original_data as $table) {
if (!empty($table)) {
if (is_array($table) && !\Arr::is_multi($table)) {
$this->multisite_tables = array_merge($this->multisite_tables, $table);
} elseif (is_string($table)) {
$this->multisite_tables = array_merge($this->multisite_tables, [$table]);
}
}
}
unset($each_cfg);
$this->multisite_tables = \Arr::unique($this->multisite_tables);
}
}
unset($plugin);
}