本文整理汇总了PHP中Options::getOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::getOptions方法的具体用法?PHP Options::getOptions怎么用?PHP Options::getOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::getOptions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see Action::execute();
*/
public function execute()
{
parent::execute();
// check permissions
WCF::getUser()->checkPermission('admin.system.canEditOption');
// header
@header('Content-type: text/xml');
// file name
@header('Content-disposition: attachment; filename="options.xml"');
// no cache headers
@header('Pragma: no-cache');
@header('Expires: 0');
// content
echo "<?xml version=\"1.0\" encoding=\"" . CHARSET . "\"?>\n<options>\n";
$options = Options::getOptions();
foreach ($options as $option) {
echo "\t<option>\n";
echo "\t\t<name><![CDATA[" . StringUtil::escapeCDATA($option['optionName']) . "]]></name>\n";
echo "\t\t<value><![CDATA[" . StringUtil::escapeCDATA($option['optionValue']) . "]]></value>\n";
echo "\t</option>\n";
}
echo '</options>';
$this->executed();
exit;
}
示例2: __construct
protected function __construct()
{
extract(Options::getOptions());
add_action('wp_enqueue_scripts', array($this, 'embedAssets'));
add_action('wp_footer', array($this, 'outputOptions'));
if ($filterContent) {
add_filter('the_content', array($this, 'filterContent'), 100);
add_filter('acf/load_value/type=wysiwyg', array($this, 'filterContent'));
add_filter('acf/load_value/type=textarea', array($this, 'filterContent'));
}
}
示例3: outputImage
private function outputImage($query)
{
extract(Options::getOptions());
$queryParam = sprintf('%s-query', $baseUrl);
$pathParam = sprintf('%s-path', $baseUrl);
if (empty($query->query[$queryParam]) || empty($query->query[$pathParam])) {
return;
}
$params = $query->query[$queryParam];
$path = preg_replace('/\\.\\.\\//', '', $query->query[$pathParam]);
$params = explode('-', $params);
$parsed = array();
foreach ($params as $param) {
if (preg_match("/(?P<operation>[a-z]{1})(?P<value>[\\S]*)/", $param, $matches) && isset(static::$operations[$matches['operation']])) {
$parsed[static::$operations[$matches['operation']]] = $matches['value'];
}
}
foreach ($parsed as $key => $value) {
switch ($key) {
case 'crop':
$dimensions = explode('x', $value);
$parsed['width'] = intval($dimensions[0]);
$parsed['height'] = intval($dimensions[1]);
$parsed['cropped'] = true;
unset($parsed[$key]);
break;
case 'extension':
$path .= '.' . preg_replace('/[^0-9a-zA-Z]*/', '', $value);
unset($parsed[$key]);
break;
case 'offset':
$dimensions = explode('x', $value);
$parsed['offsetX'] = intval($dimensions[0]);
$parsed['offsetY'] = intval($dimensions[1]);
unset($parsed[$key]);
break;
case 'width':
case 'height':
$parsed[$key] = intval($value);
break;
}
}
$image = Resize::getImage($path, $parsed);
if (is_wp_error($image)) {
wp_die($image);
}
// Set caching headers, and stream
header('Pragma: public');
header('Cache-Control: max-age=86400');
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 86400));
$image->stream();
exit;
}
示例4: isset
## load config
$config = Liberty::config();
if ($config['install'] == 0) {
$config['default']['theme'] = 'default';
$config['default']['controller'] = 'Install';
$config['default']['action'] = 'index';
$config['modules'][] = 'install';
$config['url'] = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$config['home'] = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$config['version'] = '0.1';
$config['debug'] = 'false';
} else {
## connect database
$db = schemadb::connect($config['db']['host'], $config['db']['user'], $config['db']['pass'], $config['db']['name'], $config['db']['pref']);
require_once __BASE__ . '/module/config/model/Options.php';
$c = Options::getOptions($config['type']);
$config = array_merge($config, $c);
$config['modules'][] = 'install';
}
## set debug error
Liberty::debug($config['debug']);
$lang = isset($config['lang']) && $config['lang'] != '' ? $config['lang'] : 'en';
$locale = isset($config['locale']) && $config['locale'] != '' ? $config['locale'] : 'en_EN';
$email = isset($config['mail']) && $config['mail'] != '' ? $config['mail'] : 'local@local.host';
## other constants
define('__URL__', rtrim($config['url'], '/'));
define('__HOME__', rtrim($config['home'], '/'));
define('__PUBLIC__', __URL__ . '/public');
define('__VERSION__', rtrim($config['version']));
define('__LANG__', $lang);
define('__EMAIL__', $email);
示例5: getOptions
/**
* @return array
*/
public function getOptions()
{
$this->initializeOptions();
return $this->options->getOptions();
}
示例6: getImage
public static function getImage($url, $params)
{
// Set up our arguments
extract(wp_parse_args($params, array('width' => -1, 'height' => -1, 'cropped' => false, 'offsetX' => 50, 'offsetY' => 50)));
// Options for this plugin
extract(Options::getOptions());
// Get the image file path
global $blog_id;
$path = parse_url($url);
$path = !is_multisite() ? sprintf('/%s/%s', trim(ABSPATH, '/'), trim($path['path'], '/')) : sprintf('/%1$s/wp-content/blogs.dir/%2$s/files/%3$s', trim(ABSPATH, '/'), $blog_id, trim($path['path'], '/'));
// Make sure it exists
if (!file_exists($path)) {
return new \WP_Error('invalid_path', __('No file found at this location.', 'dimages'), $path);
}
// Get information, set up for our possible resize
$pathInfo = (object) pathinfo($path);
$editor = wp_get_image_editor($path);
// Something's afoot
if (is_wp_error($editor)) {
return $editor;
}
// Do the sizing up front so we aren't creating multiple versions for smaller image sizes
// need to finalize sizing for the benefit of the filename up front
$origSize = (object) $editor->get_size();
$destSize = (object) array('width' => $width, 'height' => $height);
if ($destSize->width === -1) {
$destSize->width = $origSize->width;
}
if ($destSize->height === -1) {
$destSize->height = $origSize->height;
}
$offsetX = max(0, min(100, $offsetX));
$offsetY = max(0, min(100, $offsetY));
// Cropping is disabled by default in the admin
if ($disableCropping) {
$cropped = false;
}
if ($cropped) {
$destSize->width = min($destSize->width, $maxWidth);
$destSize->height = min($destSize->height, $maxHeight);
} else {
$constrained = wp_constrain_dimensions($origSize->width, $origSize->height, $destSize->width, $destSize->height);
$destSize = (object) array('width' => $constrained[0], 'height' => $constrained[1]);
}
// Snap dimensions and offsets to specified intervals, to prevent far too many duplicates from being created
// Snaps size up to steps
$destSize->width = ceil($destSize->width / $sizeStep) * $sizeStep;
$destSize->height = ceil($destSize->height / $sizeStep) * $sizeStep;
// Snap offsets to nearest steps
$offsetX = round($offsetX / $offsetStep) * $offsetStep;
$offsetY = round($offsetY / $offsetStep) * $offsetStep;
// Different sizing occurs for cropping vs straight resize
if ($cropped) {
// Find the ratio for the smallest dimensional difference
$ratio = min($origSize->width / $destSize->width, $origSize->height / $destSize->height);
// Scale down the destination size if we're too large
if ($ratio < 1) {
$destSize->width = round($destSize->width * $ratio);
$destSize->height = round($destSize->height * $ratio);
$ratio = 1;
}
$suffix = sprintf('cropped-%sx%s-%sx%s', $destSize->width, $destSize->height, $offsetX, $offsetY);
// Set our offset to usable numbers
$offsetXPixels = ($origSize->width - $destSize->width * $ratio) * ($offsetX / 100);
$offsetYPixels = ($origSize->height - $destSize->height * $ratio) * ($offsetY / 100);
} else {
$constrained = wp_constrain_dimensions($origSize->width, $origSize->height, $destSize->width, $destSize->height);
$destSize = (object) array('width' => $constrained[0], 'height' => $constrained[1]);
$suffix = sprintf('%sx%s', $destSize->width, $destSize->height);
}
// If dimensions match, return the original
if ($destSize->width == $origSize->width && $destSize->height == $origSize->height) {
return $editor;
}
// This is the destination file
$uploads = wp_upload_dir();
$cacheDir = preg_replace('!.*/(uploads|themes|plugins|wp_content)!', '', $pathInfo->dirname);
$resizedDir = sprintf('%s/dynamic-images-cache%s', $uploads['basedir'], $cacheDir);
$resizedPath = sprintf('%s/%s-%s.%s', $resizedDir, $pathInfo->filename, $suffix, $pathInfo->extension);
// It doesn't exist, create it
if (!file_exists($resizedPath)) {
if (!file_exists($resizedDir) && !@mkdir($resizedDir, 0755, true)) {
return new \WP_Error('permissions error', __('Unable to create cache directory.', 'dimages'), $path);
}
if ($cropped) {
$editor->crop($offsetXPixels, $offsetYPixels, $destSize->width * $ratio, $destSize->height * $ratio, $destSize->width, $destSize->height);
} else {
$editor->resize($destSize->width, $destSize->height);
}
$editor->save($resizedPath);
// Save a reference of this to our parent image if it's in the DB
self::storeReference($url, $resizedPath);
return $editor;
}
return wp_get_image_editor($resizedPath);
}