本文整理汇总了PHP中YDConfig::set方法的典型用法代码示例。如果您正苦于以下问题:PHP YDConfig::set方法的具体用法?PHP YDConfig::set怎么用?PHP YDConfig::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YDConfig
的用法示例。
在下文中一共展示了YDConfig::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDefault
function actionDefault()
{
// Get the data
$db = YDDatabase::getInstance('sqlite', 'database2.db');
// Output the server version
YDDebugUtil::dump($db->getServerVersion(), 'Version:');
// Output some queries
YDDebugUtil::dump($db->getRecords('select * from escalations'), 'escalations');
YDDebugUtil::dump($db->getRecords('select * from sqlite_master'), 'sqlite_master');
YDConfig::set('YD_DB_FETCHTYPE', YD_DB_FETCH_NUM);
YDDebugUtil::dump($db->getRecords('select * from sqlite_master'), 'array - sqlite_master');
YDConfig::set('YD_DB_FETCHTYPE', YD_DB_FETCH_ASSOC);
// Test string escaping
YDDebugUtil::dump($db->string("Pieter's Framework"), '$db->string');
// Show number of queries
YDDebugUtil::dump($db->getSqlCount(), 'Number of queries');
// Test timestamps
YDDebugUtil::dump($db->getDate(), 'getDate()');
YDDebugUtil::dump($db->getTime(), 'getTime()');
YDDebugUtil::dump($db->getDate('__NOW__'), 'getDate( \'__NOW__\' )');
YDDebugUtil::dump($db->getTime('__NOW__'), 'getTime( \'__NOW__\' )');
YDDebugUtil::dump($db->getDate('28-FEB-1977'), 'getDate( \'28-FEB-1977\' )');
YDDebugUtil::dump($db->getTime('28-FEB-1977'), 'getTime( \'28-FEB-1977\' )');
YDDebugUtil::dump($db->sqlString($db->getDate()), 'sqlString( getDate() )');
YDDebugUtil::dump($db->sqlString($db->getTime()), 'sqlString( getTime() )');
YDDebugUtil::dump($db->sqlString($db->getDate('__NOW__')), 'sqlString( getDate( \'__NOW__\' ) )');
YDDebugUtil::dump($db->sqlString($db->getTime('__NOW__')), 'sqlString( getTime( \'__NOW__\' ) )');
// Test limits
YDDebugUtil::dump($db->_prepareSqlForLimit('SELECT * FROM TABLE', 10));
YDDebugUtil::dump($db->_prepareSqlForLimit('SELECT * FROM TABLE', 10, 25));
// Test errors
YDDebugUtil::dump($db->getRecords('xx'), 'should return error');
// Close the database connection
$db->close();
}
示例2: actionDefault
function actionDefault()
{
// Set some variables
YDConfig::set('MyConfigVar1', 'value cfg1');
YDConfig::set('MyConfigVar2', 'value cfg2');
YDConfig::set('MyConfigVar3', 'value cfg3');
// Get the values
YDDebugUtil::dump(YDConfig::get('MyConfigVar1'), 'get - MyConfigVar1');
YDDebugUtil::dump(YDConfig::get('MyConfigVar2'), 'get - MyConfigVar2');
YDDebugUtil::dump(YDConfig::get('MyConfigVar3'), 'get - MyConfigVar3');
// Check if the variables exist or not
YDDebugUtil::dump(YDConfig::exists('MyConfigVar1'), 'exists - MyConfigVar1');
YDDebugUtil::dump(YDConfig::exists('MyConfigVar2'), 'exists - MyConfigVar2');
YDDebugUtil::dump(YDConfig::exists('MyConfigVar3'), 'exists - MyConfigVar3');
// Check an unexisting variable
YDDebugUtil::dump(YDConfig::exists('xx'), 'exists - xx');
// Set some variables, not overriding existing values
YDConfig::set('MyConfigVar1', 'value cfg1 changed', false);
YDConfig::set('MyConfigVar2', 'value cfg2 changed', false);
YDConfig::set('MyConfigVar3', 'value cfg3 changed', false);
// Get the values (should be unchanged)
YDDebugUtil::dump(YDConfig::get('MyConfigVar1'), 'get - MyConfigVar1 - changed1');
YDDebugUtil::dump(YDConfig::get('MyConfigVar2'), 'get - MyConfigVar2 - changed1');
YDDebugUtil::dump(YDConfig::get('MyConfigVar3'), 'get - MyConfigVar3 - changed1');
// Set some variables, overriding existing values
YDConfig::set('MyConfigVar1', 'value cfg1 changed', true);
YDConfig::set('MyConfigVar2', 'value cfg2 changed', true);
YDConfig::set('MyConfigVar3', 'value cfg3 changed', true);
// Get the values (should be changed)
YDDebugUtil::dump(YDConfig::get('MyConfigVar1'), 'get - MyConfigVar1 - changed2');
YDDebugUtil::dump(YDConfig::get('MyConfigVar2'), 'get - MyConfigVar2 - changed2');
YDDebugUtil::dump(YDConfig::get('MyConfigVar3'), 'get - MyConfigVar3 - changed2');
// Dump the contents of YDConfig
YDConfig::dump();
}
示例3: get
/**
* @returns The current locale.
*/
function get()
{
// Set the default locale
YDConfig::set(YD_LOCALE_KEY, 'en', false);
// Return the setting
return strtolower(YDConfig::get(YD_LOCALE_KEY));
}
示例4: set
/**
* This function sets the value of a part of the format.
*
* @param $name The format name.
* @param $part The part name: string, parts, regexes or empty.
* @param $value The part value.
*
* @static
*/
function set($name, $part = 'string', $value)
{
$all = YDConfig::get('YD_DATE_FORMATS');
$name = strtoupper($name);
if (!isset($all[$name])) {
$all[$name] = array('string' => '', 'parts' => array(), 'regexes' => array(), 'empty' => '');
}
$all[$name][$part] = $value;
YDConfig::set('YD_DATE_FORMATS', $all);
}
示例5: YDWeblogRequest
function YDWeblogRequest()
{
// Initialize the parent
$this->YDRequest();
// Check if we allow caching
$this->caching = true;
// Delete the cache if caching is disabled
if (YDConfig::get('use_cache', false) === false) {
$this->clearCache();
}
// Start with no userdata and check the authentication
$this->user = null;
// This requires authentication
$this->setRequiresAuthentication(true);
// Setup the weblog object
$this->weblog = new YDWeblogAPI();
// Get the skin
$this->skin = YDConfig::get('weblog_skin', 'default');
// Get the shortcuts to the directories
$this->dir_uploads = YDConfig::get('dir_uploads', 'uploads');
$this->dir_skins = YDConfig::get('dir_skins', 'skins') . '/';
// Default to default skin
if (!is_dir(dirname(__FILE__) . '/../' . $this->dir_skins . $this->skin . '/')) {
YDConfig::set('weblog_skin', 'default');
$this->skin = YDConfig::get('weblog_skin', 'default');
}
// Initialize the template
$this->tpl = new YDTemplate();
$this->tpl->template_dir = dirname(__FILE__) . '/../' . $this->dir_skins . $this->skin . '/';
// Register the modifiers
$this->tpl->register_modifier('date', 'YDTplModDate');
$this->tpl->register_modifier('link_item', 'YDTplModLinkItem');
$this->tpl->register_modifier('link_item_gallery', 'YDTplModLinkItemGallery');
$this->tpl->register_modifier('link_item_images', 'YDTplModLinkItemImages');
$this->tpl->register_modifier('link_item_comment', 'YDTplModLinkItemComment');
$this->tpl->register_modifier('link_item_respond', 'YDTplModLinkItemRespond');
$this->tpl->register_modifier('link_category', 'YDTplModLinkCategory');
$this->tpl->register_modifier('link_page', 'YDTplModLinkPage');
$this->tpl->register_modifier('link_link', 'YDTplModLinkLink');
$this->tpl->register_modifier('link_thumb', 'YDTplModLinkThumb');
$this->tpl->register_modifier('link_thumb_small', 'YDTplModLinkThumbSmall');
$this->tpl->register_modifier('text_num_comments', 'YDTplModTextNumComments');
$this->tpl->register_modifier('text_num_images', 'YDTplModTextNumImages');
}
示例6: apply
/**
* This function creates all YDF Configs
*/
function apply()
{
// if we don't have results maybe we should load them
if (empty($this->_results)) {
$this->load();
}
// cycle all results to apply YDConfig
foreach ($this->_results as $name => $value) {
YDConfig::set($name, $value);
}
}
示例7: dirname
YDConfig::set('YD_AJAX_PREFIX', "__ydf", false);
/**
* This config defines the html tag to use
* Default: </head>
*/
YDConfig::set('YD_AJAX_TAG', "</head>", false);
/**
* This config defines if ajax code must be placed after tag (true) or before tag (false).
* Default: false.
*/
YDConfig::set('YD_AJAX_AFTERTAG', false, false);
/**
* This config defines custom debug value
* Default: false
*/
YDConfig::set('YD_AJAX_DEBUG', false, false);
/**
* Include the needed libraries.
*/
require_once dirname(__FILE__) . '/xajax.inc.php';
/**
* Class definition for the YDAjax addon.
*/
class YDAjax extends xajax
{
/**
* This is the class constructor for the YDAjax class.
*
* @param $template Template object.
* @param $form Form object.
*/
示例8: YDForm
$form = new YDForm('ydcmforumpost');
$form->addElement('textarea', 'content', 'Content');
$form->addElement('button', 'cmdLogin', 'Submit');
// if we are replying to someone, let's get the content
if (is_numeric($quote_id)) {
// get replying post
$posts = new YDCMForum_posts();
$post = $posts->getElement($quote_id);
// apply default to content textarea
$form->setDefault('content', $post['post_content']);
}
return $form;
}
}
// last user login date.
YDConfig::set('YD_FORUM_LASTLOGINDATE', YDStringUtil::formatDate(time(), 'datetimesql'), false);
class YDCMForum_topics extends YDDatabaseObject
{
function YDCMForum_topics()
{
// init DB object
$this->YDDatabaseObject();
// register database as default
$this->registerDatabase();
// register table for this component
$this->registerTable('YDCMForum_topics');
// register fields
$this->registerKey('topic_id', true);
$this->registerField('topic_forum_id');
$this->registerField('topic_title');
$this->registerField('topic_user_id');
示例9: die
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Check if the framework is loaded
if (!defined('YD_FW_NAME')) {
die('Yellow Duck Framework is not loaded.');
}
// Includes
include_once YD_DIR_HOME_CLS . '/YDUtil.php';
// YDFSImage cropping specific constants
define('YD_FS_CROP_UNCHANGED', 1);
define('YD_FS_CROP_ENLARGED', 2);
define('YD_FS_CROP_BORDERED', 3);
// Config when cropping smaller images
YDConfig::set('YD_FS_CROP', YD_FS_CROP_ENLARGED, false);
// The mime types mapping
$GLOBALS['YD_FS_MIME_MAPPING'] = array('ez' => 'application/andrew-inset', 'hqx' => 'application/mac-binhex40', 'cpt' => 'application/mac-compactpro', 'mathml' => 'application/mathml+xml', 'doc' => 'application/msword', 'oda' => 'application/oda', 'ogg' => 'application/ogg', 'pdf' => 'application/pdf', 'rdf' => 'application/rdf+xml', 'gram' => 'application/srgs', 'grxml' => 'application/srgs+xml', 'mif' => 'application/vnd.mif', 'xul' => 'application/vnd.mozilla.xul+xml', 'xls' => 'application/vnd.ms-excel', 'ppt' => 'application/vnd.ms-powerpoint', 'wbxml' => 'application/vnd.wap.wbxml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'vxml' => 'application/voicexml+xml', 'bcpio' => 'application/x-bcpio', 'vcd' => 'application/x-cdlink', 'pgn' => 'application/x-chess-pgn', 'cpio' => 'application/x-cpio', 'csh' => 'application/x-csh', 'dvi' => 'application/x-dvi', 'spl' => 'application/x-futuresplash', 'gtar' => 'application/x-gtar', 'hdf' => 'application/x-hdf', 'js' => 'application/x-javascript', 'latex' => 'application/x-latex', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'swf' => 'application/x-shockwave-flash', 'sit' => 'application/x-stuffit', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'man' => 'application/x-troff-man', 'me' => 'application/x-troff-me', 'ms' => 'application/x-troff-ms', 'ustar' => 'application/x-ustar', 'src' => 'application/x-wais-source', 'xslt' => 'application/xslt+xml', 'dtd' => 'application/xml-dtd', 'zip' => 'application/zip', 'm3u' => 'audio/x-mpegurl', 'rpm' => 'audio/x-pn-realaudio-plugin', 'ra' => 'audio/x-realaudio', 'wav' => 'audio/x-wav', 'pdb' => 'chemical/x-pdb', 'xyz' => 'chemical/x-xyz', 'bmp' => 'image/bmp', 'cgm' => 'image/cgm', 'gif' => 'image/gif', 'ief' => 'image/ief', 'png' => 'image/png', 'jpg' => 'image/jpeg', 'svg' => 'image/svg+xml', 'wbmp' => 'image/vnd.wap.wbmp', 'ras' => 'image/x-cmu-raster', 'ico' => 'image/x-icon', 'pnm' => 'image/x-portable-anymap', 'pbm' => 'image/x-portable-bitmap', 'pgm' => 'image/x-portable-graymap', 'ppm' => 'image/x-portable-pixmap', 'rgb' => 'image/x-rgb', 'xbm' => 'image/x-xbitmap', 'xpm' => 'image/x-xpixmap', 'xwd' => 'image/x-xwindowdump', 'css' => 'text/css', 'rtx' => 'text/richtext', 'rtf' => 'text/rtf', 'tsv' => 'text/tab-separated-values', 'wml' => 'text/vnd.wap.wml', 'wmls' => 'text/vnd.wap.wmlscript', 'etx' => 'text/x-setext', 'avi' => 'video/x-msvideo', 'movie' => 'video/x-sgi-movie', 'ice' => 'x-conference/x-cooltalk', 'php' => 'text/plain');
/**
* This class houses all different path related functions.
*/
class YDPath extends YDBase
{
/**
* Provides a platform-specific character used to separate directory levels in a path string that reflects a
* hierarchical file system organization.
*
* @returns String containing the directory separator
*
* @static
*/
示例10: or
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Check if the framework is loaded
if (!defined('YD_FW_NAME')) {
die('Yellow Duck Framework is not loaded.');
}
// set components path
YDConfig::set('YD_DBOBJECT_PATH', YD_DIR_HOME_ADD . '/YDCMComponent', false);
// include YDF libs
YDInclude('YDDatabaseObject.php');
YDInclude('YDResult.php');
// add translations directory for generic translations
YDLocale::addDirectory(dirname(__FILE__) . '/languages/');
class YDCMPermission extends YDDatabaseObject
{
function YDCMPermission()
{
// init component as non default
$this->YDDatabaseObject();
// register database as default
$this->registerDatabase();
// register table for this component
$this->registerTable('YDCMPermission');
示例11: dirname
<?php
// Standard include
include_once dirname(__FILE__) . '/../include/YDWeblog_init.php';
// We don't limit the execution time
set_time_limit(0);
// Includes
YDInclude('YDRequest.php');
YDInclude('YDFileSystem.php');
YDInclude('YDUrl.php');
// Config setting
YDConfig::set('updateDbUrl', 'http://ydframework.berlios.de/weblog_updater.php');
YDConfig::set('currentBranch', '/YDFramework2.0/trunk/');
YDConfig::set('chkoutUrl', 'http://svn.berlios.de/viewcvs/*checkout*/ydframework');
// Logger class
class YDUpdateLog
{
// Flush a message to the browser
function flushMsg($msg, $fatal)
{
echo $msg . '<br/>' . YD_CRLF;
@ob_flush();
@flush();
if ($fatal) {
die;
}
}
// Log an info message
function info($msg, $fatal = false)
{
YDUpdateLog::flushMsg('<font color="#009900">[ INFO ] ' . $msg . '</font>', $fatal);
示例12: die
// Check if the framework is loaded
if (!defined('YD_FW_NAME')) {
die('Yellow Duck Framework is not loaded.');
}
// Includes
include_once YD_DIR_HOME_CLS . '/YDForm.php';
/**
* This config defines the start tag to show before render an element
* Default: '<p>'
*/
YDConfig::set('YD_RENDER_HTML_PRETAG', "<p>", false);
/**
* This config defines the end tag to show after render an element
* Default: '<p>'
*/
YDConfig::set('YD_RENDER_HTML_POSTAG', "</p>", false);
/**
* This is the class that is able to render a form object to HTML.
*
* @ingroup YDForm
*/
class YDFormRenderer_html extends YDFormRenderer
{
/**
* This is the class constructor for the YDFormRenderer_html class.
*
* @param $form The form that needs to be rendered.
*/
function YDFormRenderer_html($form)
{
// Initialize the parent
示例13: die
die('Yellow Duck Framework is not loaded.');
}
// Includes
include_once YD_DIR_HOME_CLS . '/YDFileSystem.php';
// The different log levels
@define('YD_LOG_DEBUG', 4);
@define('YD_LOG_INFO', 3);
@define('YD_LOG_WARNING', 2);
@define('YD_LOG_ERROR', 1);
// Configure the default for this class
YDConfig::set('YD_LOG_LEVEL', YD_LOG_INFO, false);
YDConfig::set('YD_LOG_FILE', YDPath::join(YD_DIR_TEMP, 'YDFramework2_log.xml'), false);
YDConfig::set('YD_LOG_FORMAT', 'XML', false);
YDConfig::set('YD_LOG_TEXTFORMAT', "%date% | %level% | %uri% | %basefile%:%line% | %function% | %message%", false);
YDConfig::set('YD_LOG_WRAPLINES', false, false);
YDConfig::set('YD_LOG_MAX_LINESIZE', 100, false);
/**
* This class defines the logging static functions.
*
* @ingroup YDFramework
*/
class YDLog extends YDBase
{
/**
* This adds a debug message to the logfile.
*
* @param $text The message to add to the logfile.
*
* @static
*/
function debug($text)
示例14: die
*/
/**
* @addtogroup YDFramework Core
*/
// Check if the framework is loaded
if (!defined('YD_FW_NAME')) {
die('Yellow Duck Framework is not loaded.');
}
// Includes
include_once YD_DIR_HOME_CLS . '/YDEncryption.php';
// Constants
YDConfig::set('YD_PERSISTENT_STORE_NAME', strtoupper(str_replace(' ', '_', YD_FW_NAME)) . '_PERSISTENT_STORE', false);
YDConfig::set('YD_PERSISTENT_DEFAULT_LIFETIME', 0, false);
YDConfig::set('YD_PERSISTENT_DEFAULT_PASSWORD', null, false);
YDConfig::set('YD_PERSISTENT_SCOPE', '/', false);
YDConfig::set('YD_ALLOW_OVERRIDE_QS', false, false);
/**
* This class is able to save and load persistent data. This data stay active between different requests and allows
* you to share data between different requests and different sessions.
*
* @todo
* The default scope of the persistent variable should be the current script in stead of the root of the site.
* The problem is that if you use the variable for e.g. storing sorting data, and use different ones over
* different pages, they clash with each other.
*
* @ingroup YDFramework
*/
class YDPersistent extends YDBase
{
/**
* This function initializes the persistent object store.
示例15: array
YDConfig::set('YD_DATABASEOBJECT_PATH', YD_SELF_DIR, false);
/**
* YDDatabaseObjects file extension.
* Default: YD_SCR_EXT
*/
YDConfig::set('YD_DATABASEOBJECT_EXT', YD_SCR_EXT, false);
/**
* This constant defines if a DELETE query with no conditions can be executed.
* Default: false.
*/
YDConfig::set('YD_DATABASEOBJECT_DELETE', false, false);
/**
* This constant defines if a UPDATE query with no conditions can be executed.
* Default: false.
*/
YDConfig::set('YD_DATABASEOBJECT_UPDATE', false, false);
YDInclude('YDDatabase.php');
YDInclude('YDSqlQuery.php');
/**
* This class defines a YDDatabaseObject object.
*/
class YDDatabaseObject extends YDBase
{
var $__db = null;
var $__table = null;
var $__sql = null;
var $__last = array();
var $__fields = array();
var $__keys = array();
var $__relations = array();
var $__protected = array();