当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugin::getSetting方法代码示例

本文整理汇总了PHP中Plugin::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::getSetting方法的具体用法?PHP Plugin::getSetting怎么用?PHP Plugin::getSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugin的用法示例。


在下文中一共展示了Plugin::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct()
 {
     if (!function_exists('gd_info')) {
         if (!$this->_isInternal()) {
             page_not_found();
         } else {
             // TODO: improve this
             Flash::set('error', 'Image - ' . __('GD Library is either not installed or not enabled, check your phpinfo().'));
         }
         exit;
     }
     parent::__construct();
     if ($this->_isInternal()) {
         $this->setLayout('backend');
         $this->assignToLayout('sidebar', new View('../../plugins/image/views/sidebar'));
     }
     // get setting from db
     $src = Plugin::getSetting('path', 'image');
     if ($src !== '/') {
         $src = '/' . $src;
     }
     if (substr($src, strlen($src) - 1) !== '/') {
         $src = $src . '/';
     }
     $this->_image_root = CMS_ROOT . $src;
 }
开发者ID:sindotnet,项目名称:canareef,代码行数:26,代码来源:ImageController.php

示例2: index

 public function index($page = 0)
 {
     $totalTags = Tagger::findAll();
     $CurPage = isset($page) ? $page : 0;
     $rowspage = Plugin::getSetting('rowspage', 'tagger');
     // New functions added in to make sorting tags easier on the backend.
     $sort_field = Plugin::getSetting('sort_field', 'tagger');
     $sort_order = Plugin::getSetting('sort_order', 'tagger');
     $order_by = Tagger::sortField($sort_field) . ' ' . $sort_order;
     $start = $CurPage * $rowspage;
     $totalrecords = count($totalTags);
     $lastpage = ceil($totalrecords / $rowspage);
     $lastpage = $totalrecords <= $rowspage ? 0 : abs($lastpage - 1);
     /* Get data. */
     $tags = Tagger::findAll(array('offset' => $start, 'limit' => $rowspage, 'order' => $order_by));
     $this->display('tagger/views/index', array('tags' => $tags, 'currentpage' => $CurPage, 'lastpage' => $lastpage));
 }
开发者ID:silentworks,项目名称:tagger,代码行数:17,代码来源:TaggerController.php

示例3: downloads_catch_click

function downloads_catch_click($args) {

	//	check for download
	if (preg_match('#^/download-file/(\d+)#i',$args,$matches)) {
		
		//	update the click count of the banner
		$id = (int)$matches[1];
		if (!$download = Download::findById($id)) return $args;
		$download->downloads++;
		$download->save();
		
		//	redirect to the requested url
		header ('HTTP/1.1 301 Moved Permanently', true);
		header ('Location: /'.Plugin::getSetting('download_uri','downloads').'/'.$download->filename);

		exit;
	}
	
	//	check for download by name
	if (preg_match('#^/download-file/(.*)$#i',$args,$matches)) {
		
		//	update the click count of the banner
		$filename = $matches[1];
		if (!$download = Download::findByFilename($filename)) return $args;
		$download->downloads++;
		$download->save();
		
		//	redirect to the requested url
		header ('HTTP/1.1 301 Moved Permanently', true);
		header ('Location: /'.Plugin::getSetting('download_uri','downloads').'/'.$download->filename);

		exit;
	}
	
	//	no click so keep going
	return $args;
}
开发者ID:realslacker,项目名称:Downloads-Plugin,代码行数:37,代码来源:index.php

示例4: index

    function index() {
		
		self::__checkPermission('redirector_view');
		
		//	cleanup old redirects
		$expireafter = Plugin::getSetting('expireafter', 'redirector');
		if ( $expireafter > 0 ) {
			Record::deleteWhere('RedirectorRedirects',"updated < DATE_SUB(NOW(), INTERVAL {$expireafter} DAY) AND perm='0'");
			Record::deleteWhere('Redirector404s',"updated < DATE_SUB(NOW(), INTERVAL {$expireafter} DAY)");
		}
		
		$data['redirects'] = RedirectorRedirects::findAll( array(
			'order'=>'redirects.dest, redirects.url'
		) );
		
		$threshold = Plugin::getSetting('threshold', 'redirector');
		$data['errors'] = Redirector404s::findAll( array(
			'where'=>'error404s.hits >= ' . $threshold,
			'order'=>'error404s.hits DESC'
		) );
		
		$this->display( 'redirector/views/index', $data );
    
    }
开发者ID:realslacker,项目名称:Redirector-Plugin,代码行数:24,代码来源:RedirectorController.php

示例5: _upload_file

 private function _upload_file($origin, $dest, $tmp_name, $overwrite = false)
 {
     FileManagerController::_checkPermission();
     AuthUser::load();
     if (!AuthUser::hasPermission('file_manager_upload')) {
         return false;
     }
     $origin = basename($origin);
     $full_dest = $dest . $origin;
     $file_name = $origin;
     for ($i = 1; file_exists($full_dest); $i++) {
         if ($overwrite) {
             unlink($full_dest);
             continue;
         }
         $file_ext = strpos($origin, '.') === false ? '' : '.' . substr(strrchr($origin, '.'), 1);
         $file_name = substr($origin, 0, strlen($origin) - strlen($file_ext)) . '_' . $i . $file_ext;
         $full_dest = $dest . $file_name;
     }
     if (move_uploaded_file($tmp_name, $full_dest)) {
         // change mode of the uploaded file
         $mode = Plugin::getSetting('filemode', 'file_manager');
         chmod($full_dest, octdec($mode));
         return $file_name;
     }
     return false;
 }
开发者ID:svanlaere,项目名称:wolfcms,代码行数:27,代码来源:FileManagerController.php

示例6: render

 /**
  * Display tags on a page
  *
  * @since 1.4.0
  * @param string booleon booleon
  */
 public static function render($option = array())
 {
     // Tag settings from database
     $tag_setting_type = Plugin::getSetting('tag_type', 'tagger');
     $tag_setting_case = Plugin::getSetting('case', 'tagger');
     // Tag display
     $tag_type = array_key_exists('type', $option) ? $option['type'] : $tag_setting_type;
     $tag_case = array_key_exists('case', $option) ? $option['case'] : $tag_setting_case;
     // Setting Sort order, Limit, Parent and Tagger page if selected
     $limit_set = array_key_exists('limit', $option) ? " LIMIT 0, {$option['limit']}" : NULL;
     $parent = array_key_exists('parent', $option) ? " AND page.parent_id = {$option['parent']}" : NULL;
     $tagger_page = array_key_exists('tagger_page', $option) ? $option['tagger_page'] : NULL;
     $tpl = array_key_exists('tagger_tpl', $option) ? $option['tagger_tpl'] : NULL;
     $order_by = array_key_exists('order_by', $option) && $option['order_by'] == 'count' ? ' ORDER BY count DESC' : NULL;
     $sql = 'SELECT name, count FROM ' . TABLE_PREFIX . 'tag AS tag, ' . TABLE_PREFIX . 'page AS page, ' . TABLE_PREFIX . 'page_tag AS page_tag' . ' WHERE tag.id = page_tag.tag_id AND page_tag.page_id = page.id AND page.status_id != ' . Page::STATUS_HIDDEN . ' AND' . ' page.status_id != ' . Page::STATUS_DRAFT . $parent . ' GROUP BY tag.id' . $order_by . $limit_set;
     $stmt = Record::getConnection()->prepare($sql);
     $stmt->execute();
     // Putting Tags into a array
     while ($tag = $stmt->fetchObject()) {
         $tags[$tag->name] = $tag->count;
     }
     if (isset($tags)) {
         // Sort array
         uksort($tags, 'cmpVals');
         switch ($tag_type) {
             case "cloud":
                 $max_size = 28;
                 // max font size in pixels
                 $min_size = 10;
                 // min font size in pixels
                 // largest and smallest array values
                 $max_qty = max(array_values($tags));
                 $min_qty = min(array_values($tags));
                 // find the range of values
                 $spread = $max_qty - $min_qty;
                 if ($spread == 0) {
                     $spread = 1;
                 }
                 // set the font-size increment
                 $step = ($max_size - $min_size) / $spread;
                 if ($tpl) {
                     eval('?>' . self::tpl($tpl));
                 } else {
                     echo '<ul class="tagger">';
                     foreach ($tags as $key => $value) {
                         // calculate font-size, find the $value in excess of $min_qty, multiply by the font-size increment ($size) and add the $min_size set above
                         $size = round($min_size + ($value - $min_qty) * $step);
                         $key_case = $tag_case == "1" ? ucfirst($key) : strtolower($key);
                         $url = self::tag_url($tagger_page) . slugify($key) . URL_SUFFIX;
                         echo sprintf('<li style="display: inline; border: none;"><a href="%s"  style="display: inline; border: none; font-size: %spx; padding: 2px" title="%s things tagged with %s">%s</a></li>' . "\r\n", $url, $size, $value, $key, htmlspecialchars_decode($key_case));
                     }
                     echo '</ul>';
                 }
                 break;
             case "count":
                 if ($tpl) {
                     eval('?>' . self::tpl($tpl));
                 } else {
                     echo '<ul class="tagger">';
                     foreach ($tags as $key => $value) {
                         $key_case = $tag_case == "1" ? ucfirst($key) : strtolower($key);
                         $url = self::tag_url($tagger_page) . slugify($key) . URL_SUFFIX;
                         echo sprintf('<li><a href="%s" title="%s things tagged with %s">%s (%s)</a></li>', $url, $value, $key, htmlspecialchars_decode($key_case), $value);
                     }
                     echo '</ul>';
                 }
                 break;
             default:
                 if ($tpl) {
                     eval('?>' . self::tpl($tpl));
                 } else {
                     echo '<ul class="tagger">';
                     foreach ($tags as $key => $value) {
                         $key_case = $tag_case == 1 ? ucfirst($key) : strtolower($key);
                         $url = self::tag_url($tagger_page) . slugify($key) . URL_SUFFIX;
                         echo sprintf('<li><a href="%s" title="%s things tagged with %s">%s</a></li>', $url, $value, $key, htmlspecialchars_decode($key_case));
                     }
                     echo '</ul>';
                 }
                 break;
         }
     }
 }
开发者ID:silentworks,项目名称:tagger,代码行数:89,代码来源:index.php

示例7: get_url

 * Downloads Plugin for WolfCMS <http://www.wolfcms.org>
 * Copyright (C) 2011 Shannon Brooks <shannon@brooksworks.com>
 *
 * This file is part of Downloads Plugin. Downloads Plugin is licensed under the GNU GPLv3 license.
 * Please see license.txt for the full license text.
 */

// Security Measure
if (!defined('IN_CMS')) { exit(); }

?>
<p class="button"><a href="<?php echo get_url('plugin/downloads'); ?>"><img src="<?php echo PLUGINS_URI;?>/downloads/images/list.png" align="middle" /><?php echo __('List'); ?></a></p>
<p class="button"><a href="<?php echo get_url('plugin/downloads/add'); ?>"><img src="<?php echo PLUGINS_URI;?>/downloads/images/new.png" align="middle" /><?php echo __('Add New'); ?></a></p>
<p class="button"><a href="<?php echo get_url('plugin/downloads/documentation'); ?>"><img src="<?php echo PLUGINS_URI;?>/downloads/images/documentation.png" align="middle" /><?php echo __('Documentation'); ?></a></p>
<div class="box">
<h2><?php echo __('Download Manager Plugin');?></h2>
<p>
<?php echo __('Plugin Version').': '.Plugin::getSetting('version', 'downloads'); ?>
</p>
<br />
<h2><?php echo __('Usage');?></h2>
<p><strong>Single Download</strong><br />
<code>&lt;?php echo downloadLinkById($id,$linktext); ?&gt;<br />
&lt;?php echo downloadBoxById($id); ?&gt;<br />
&lt;?php echo downloadPlayerById($id,$text); ?&gt;</code></p>
<p><strong>Multiple Downloads</strong><br />
<code>&lt;?php echo downloadListByTag($tags); ?&gt;<br />
&lt;?php echo downloadBoxesByTag($tags); ?&gt;
&lt;?php echo downloadBoxesAll(); ?&gt;</code></p>
</div>
开发者ID:realslacker,项目名称:Downloads-Plugin,代码行数:30,代码来源:sidebar.php

示例8: registered_users_page_found

function registered_users_page_found($page)
{
    $PDO = Record::getConnection();
    // If login is required for the page
    if ($page->getLoginNeeded() == Page::LOGIN_REQUIRED) {
        AuthUser::load();
        // Not Logged In
        if (!AuthUser::isLoggedIn()) {
            // Get the current page id
            $requested_page_id = $page->id();
            // Let's get the page that is set as the login page to prevent any loopbacks
            $getloginpage = 'SELECT * FROM ' . TABLE_PREFIX . "page WHERE behavior_id='login_page'";
            $getloginpage = $PDO->prepare($getloginpage);
            $getloginpage->execute();
            while ($loginpage = $getloginpage->fetchObject()) {
                $slug = $loginpage->slug;
                print_r($loginpage);
            }
            if ($requested_page_id != $loginpage_id) {
                header('Location: ' . BASE_URL . $slug);
            }
        } else {
            // We need to check if the user has permission to access the page
            // Get requested page id
            $requested_page_id = $page->id();
            // Get permissions that are required for this page
            $permissions_check = "SELECT * FROM " . TABLE_PREFIX . "permission_page WHERE page_id='{$requested_page_id}'";
            $permissions_check = $PDO->prepare($permissions_check);
            $permissions_check->execute();
            $permission_array = array();
            while ($permission = $permissions_check->fetchObject()) {
                $page_permission = $permission->permission_id;
                array_push($permission_array, $page_permission);
            }
            $permissions_count = count($permission_array);
            AuthUser::load();
            $userid = AuthUser::getRecord()->id;
            // Get permissions that this user has
            /*
            			$user_permissions_check = "SELECT * FROM ".TABLE_PREFIX."user_permission WHERE user_id='$userid'";
            			$user_permissions_check = $__CMS_CONN__->prepare($user_permissions_check);
            			$user_permissions_check->execute();
            
            			$user_permissions_array = array();
            
            			while ($user_permissions = $user_permissions_check->fetchObject()) {
            				$user_permission = $user_permissions->permission_id;
            				array_push($user_permissions_array, $user_permission);
            			}*/
            $roles = AuthUser::getRecord()->roles();
            foreach ($roles as $role) {
                $user_permissions_array[] = $role->id;
            }
            $permission_result = array_intersect($permission_array, $user_permissions_array);
            $permission_result_count = count($permission_result);
            if ($permission_result_count < 1 && AuthUser::getId() != 1) {
                // Let's get the authorisation required page
                $auth_required_page = Plugin::getSetting("auth_required_page", "registered_users");
                header('Location: ' . URL_PUBLIC . '' . $auth_required_page . '');
            }
        }
    }
}
开发者ID:blr21560,项目名称:registered_users,代码行数:63,代码来源:RUObservers.php

示例9: __

?>
</a></p>
<div class="box">
<h2><?php 
echo __('Backup/Restore plugin');
?>
</h2>
<p>
<?php 
echo __('The Backup/Restore plugin allows you to create complete backups of the Wolf CMS core database.');
?>
<br />
</p>
<p>
<?php 
echo __('Version');
?>
 - <?php 
echo BR_VERSION;
?>
<br />
<?php 
echo __('Designed for Wolf version') . ' ' . Plugin::getSetting('wolfversion', 'backup_restore');
?>
 <?php 
echo __('and upwards.') . '<br />';
?>

</p>
</div>
开发者ID:sindotnet,项目名称:dashhotel,代码行数:30,代码来源:sidebar.php

示例10: use_helper

 * Project home
 * http://www.github.com/realslacker/Redirector-Plugin
 */

//	security measure
if (!defined('IN_CMS')) { exit(); }

//	include the Installer helper
use_helper('Installer');

//	only support MySQL
$driver = Installer::getDriver();
if ( $driver != 'mysql' && $driver != 'sqlite' ) Installer::failInstall( 'redirector', __('Only MySQL and SQLite are supported!') );

//	get plugin version
$version = Plugin::getSetting('version', 'redirector');

switch ($version) {

	//	no version found so we do a clean install
	default:
	
		//	sanity check to make sure we are really dealing with a clean install
		if ($version !== false) Installer::failInstall( 'redirector', __('Unknown Version!') );
		
		
		//	make sure we aren't upgrading from a legacy version, if we are store legacy version for upgrade and fail install
		if ( Installer::$__CONN__->query('SELECT COUNT(*) FROM ' . TABLE_PREFIX . 'redirector_redirects') ) {
			
			$settings = array( 'version' => '0.2.1' );
			if ( ! Plugin::setAllSettings($settings, 'redirector') ) Installer::failInstall( 'redirector', __('Unable to store legacy version!') );
开发者ID:realslacker,项目名称:Redirector-Plugin,代码行数:31,代码来源:enable.php

示例11: checkOld

<?php

$version = Plugin::getSetting('version', 'ckeditor');
if (!$version || $version == null) {
    $upgrade = checkOld();
    if ($upgrade) {
        $PDO = Record::getConnection();
        $tablename = TABLE_PREFIX . 'ckeditor';
        $sql_check = "SELECT COUNT(*) FROM {$tablename}";
        $sql = "SELECT * FROM {$tablename}";
        $result = $PDO->query($sql_check);
        if ($result && $result->fetchColumn() != 1) {
            $result->closeCursor();
            Flash::set('error', __('ckeditor - upgrade needed, but invalid upgrade scenario detected!'));
            return;
        }
        if (!$result) {
            Flash::set('error', __('ckeditor - upgrade need detected earlier, but unable to retrieve table information!'));
            return;
        }
        $result = $PDO->query($sql);
        if ($result && ($row = $result->fetchObject())) {
            $settings = array('version' => '1.1', 'fileBrowserEnable' => $row->fileBrowserEnable, 'fileBrowserRootDir' => $row->fileBrowserRootDir, 'fileBrowserRootUri' => $row->fileBrowserRootUri, 'urlBrowserEnable' => $row->urlBrowserEnable, 'urlBrowserListHidden' => $row->urlBrowserListHidden, 'editorContentsCss' => $row->editorContentsCss, 'editorToolbarSet' => $row->editorToolbarSet);
            $result->closeCursor();
        } else {
            Flash::set('error', __('ckeditor - upgrade needed, but unable to retrieve old settings!'));
            return;
        }
    } else {
        $defaultFileBrowserImagesdir = dirname(dirname(dirname(dirname(__FILE__)))) . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'images';
        $settings = array('version' => '1.1', 'fileBrowserEnable' => 1, 'fileBrowserRootDir' => $defaultFileBrowserImagesdir, 'fileBrowserRootUri' => '/public/images', 'urlBrowserEnable' => 1, 'urlBrowserListHidden' => 0, 'editorContentsCss' => '', 'editorToolbarSet' => 'Full');
开发者ID:nowotny,项目名称:wolf_ckeditor,代码行数:31,代码来源:enable.php

示例12: __

<?php
/*
 * Banner Plugin for WolfCMS <http://www.wolfcms.org>
 * Copyright (C) 2011 Shannon Brooks <shannon@brooksworks.com>
 *
 * This file is part of Banner Plugin. Banner Plugin is licensed under the GNU GPLv3 license.
 * Please see license.txt for the full license text.
 */

// Security Measure
if (!defined('IN_CMS')) { exit(); }

?>
<p class="button"><a href="<?=get_url('plugin/banner'); ?>"><img src="<?php echo URL_PUBLIC; ?>wolf/plugins/banner/images/list.png" align="middle" /><?php echo __('List Banners'); ?></a></p>
<p class="button"><a href="<?=get_url('plugin/banner/banner_add'); ?>"><img src="<?php echo URL_PUBLIC; ?>wolf/plugins/banner/images/new.png" align="middle" /><?php echo __('Add Banner'); ?></a></p>
<p class="button"><a href="<?=get_url('plugin/banner/documentation'); ?>"><img src="<?php echo URL_PUBLIC; ?>wolf/plugins/banner/images/documentation.png" align="middle" /><?php echo __('Documentation'); ?></a></p>
<div class="box">
<h2><?php echo __('Banners Plugin');?></h2>
<p>
<?php echo __('Plugin Version').': '.Plugin::getSetting('version', 'banner'); ?>
</p>
</div>
开发者ID:realslacker,项目名称:Banner-Plugin,代码行数:22,代码来源:sidebar.php

示例13: url

 /**
  * Returns the current PageArchive object's url.
  *
  * Note: overrides the Page::url() method.
  *
  * @return string   A fully qualified url.
  */
 public function url($suffix = false)
 {
     $use_date = Plugin::getSetting('use_dates', 'archive');
     if ($use_date === '1') {
         return BASE_URL . trim($this->parent()->path() . date('/Y/m/d/', strtotime($this->created_on)) . $this->slug, '/') . ($this->path() != '' ? URL_SUFFIX : '');
     } elseif ($use_date === '0') {
         return BASE_URL . trim($this->parent()->path() . '/' . $this->slug, '/') . ($this->path() != '' ? URL_SUFFIX : '');
     }
 }
开发者ID:crick-ru,项目名称:wolfcms,代码行数:16,代码来源:archive.php

示例14: array

<?php

/*
 * Wolf CMS - Content Management Simplified. <http://www.wolfcms.org>
 * Copyright (C) 2009-2011 Martijn van der Kleijn <martijn.niji@gmail.com>
 *
 * This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
 * Please see license.txt for the full license text.
 */
/* Security measure */
if (!defined('IN_CMS')) {
    exit;
}
/**
 * The BackupRestore plugin provides administrators with the option of backing
 * up their pages and settings to an XML file.
 *
 * @package Plugins
 * @subpackage backup_restore
 *
 * @author Martijn van der Kleijn <martijn.niji@gmail.com>
 * @copyright Martijn van der Kleijn, 2009-2011
 * @license http://www.gnu.org/licenses/gpl.html GPLv3 license
 */
// Check if the plugin's settings already exist and create them if not.
if (Plugin::getSetting('zip', 'backup_restore') === false) {
    // Store settings new style
    $settings = array('zip' => '1', 'pwd' => '1', 'default_pwd' => 'pswpsw123', 'stamp' => 'Ymd', 'extension' => 'xml', 'wolfversion' => '0.6.0');
    Plugin::setAllSettings($settings, 'backup_restore');
}
开发者ID:sindotnet,项目名称:dashhotel,代码行数:30,代码来源:enable.php

示例15: page_snippetslist_tab

function page_snippetslist_tab($page)
{
    $view = Plugin::getSetting('ui', 'easysnippet');
    echo new View(PLUGINS_ROOT . DS . 'easysnippet' . DS . 'views' . DS . $view, array('snippets' => grouped_snippets()));
}
开发者ID:svanlaere,项目名称:easysnippet,代码行数:5,代码来源:index.php


注:本文中的Plugin::getSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。