本文整理汇总了PHP中Solar_File类的典型用法代码示例。如果您正苦于以下问题:PHP Solar_File类的具体用法?PHP Solar_File怎么用?PHP Solar_File使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Solar_File类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_belongsTo('node');
}
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:14,代码来源:Comments.php
示例2: _exec
/**
*
* Write out a series of dirs and symlinks for a new Vendor source.
*
* @param string $vendor The Vendor name.
*
* @return void
*
*/
protected function _exec($vendor = null)
{
// we need a vendor name, at least
if (!$vendor) {
throw $this->_exception('ERR_NO_VENDOR_NAME');
}
$this->_outln("Removing links for vendor '{$vendor}' ...");
// build "foo-bar" and "FooBar" versions of the vendor name.
$this->_inflect = Solar_Registry::get('inflect');
$this->_dashes = $this->_inflect->camelToDashes($vendor);
$this->_studly = $this->_inflect->dashesToStudly($this->_dashes);
// the base system dir
$system = Solar::$system;
// the links to remove (reverse order from make-vendor)
$links = array("script/{$this->_dashes}", "include/Mock/{$this->_studly}", "include/Test/{$this->_studly}", "include/{$this->_studly}");
// remove the links
foreach ($links as $link) {
$this->_out(" Removing '{$link}' ... ");
$path = "{$system}/{$link}";
if (Solar_File::exists($path)) {
unlink($path);
$this->_outln("done.");
} else {
$this->_outln("missing.");
}
}
// done!
$this->_outln("... done.");
// reminders
$this->_outln("Remember to remove '{$this->_studly}_App' from the " . "['Solar_Controller_Front']['classes'] element " . "in your config file.");
$this->_outln("Remember to remove '{$this->_studly}_Model' from the " . "['Solar_Sql_Model_Catalog']['classes'] element " . "in your config file.");
// need to write a recursive-remove method for Solar_Dir that will
// delete only the symlinked files (not the real files)
$this->_outln("You will need to remove the " . "'docroot/public/{$this->_studly}' directory yourself, as it " . "may contain copies of public assets (not links).");
}
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:44,代码来源:UnlinkVendor.php
示例3: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = $this->_config['prefix'] . Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_hasMany('moduleinfo', array('foreign_class' => 'Foresmo_Model_ModuleInfo', 'foreign_key' => 'module_id'));
}
开发者ID:agentile,项目名称:foresmo,代码行数:14,代码来源:Modules.php
示例4: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = $this->_config['prefix'] . Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_belongsTo('comments', array('foreign_class' => 'Foresmo_Model_Comments'));
}
开发者ID:btweedy,项目名称:foresmo,代码行数:14,代码来源:CommentInfo.php
示例5: fetch
/**
*
* Fetches the roles for a username.
*
* @param string $handle User handle to get roles for.
*
* @return array An array of discovered roles.
*
*/
public function fetch($handle)
{
// force the full, real path to the file
$file = realpath($this->_config['file']);
// does the file exist?
if (!Solar_File::exists($file)) {
throw $this->_exception('ERR_FILE_NOT_READABLE', array('file' => $file));
}
// load the file as an array of lines
$lines = file($file);
// the discovered roles
$roles = array();
// loop through each line, find the group, then see if the user
// is on the line anywhere
foreach ($lines as $line) {
// eliminate all spaces, which cause mismatches when we get to
// in_array() later
$line = preg_replace("/\\s/", '', $line);
// break apart at first ':'
$pos = strpos($line, ':');
// the group name is the part before the ':'
$group = substr($line, 0, $pos);
// the list of user handles comes after
$tmp = substr($line, $pos + 1);
$list = explode(',', $tmp);
// is the user part of the group?
if (in_array($handle, $list)) {
$roles[] = $group;
}
}
// done!
return $roles;
}
开发者ID:agentile,项目名称:foresmo,代码行数:42,代码来源:File.php
示例6: autoload
/**
*
* Loads a class or interface file from the include_path.
*
* Thanks to Robert Gonzalez for the report leading to this method.
*
* @param string $name A Solar (or other) class or interface name.
*
* @return void
*
* @todo Add localization for errors
*
*/
public static function autoload($name)
{
// did we ask for a non-blank name?
if (trim($name) == '') {
throw Solar::exception('Solar_Class', 'ERR_AUTOLOAD_EMPTY', 'No class or interface named for loading.', array('name' => $name));
}
// pre-empt further searching for the named class or interface.
// do not use autoload, because this method is registered with
// spl_autoload already.
$exists = class_exists($name, false) || interface_exists($name, false);
if ($exists) {
return;
}
// convert the class name to a file path.
$file = str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php';
// include the file and check for failure. we use Solar_File::load()
// instead of require() so we can see the exception backtrace.
Solar_File::load($file);
// if the class or interface was not in the file, we have a problem.
// do not use autoload, because this method is registered with
// spl_autoload already.
$exists = class_exists($name, false) || interface_exists($name, false);
if (!$exists) {
throw Solar::exception('Solar_Class', 'ERR_AUTOLOAD_FAILED', 'Class or interface does not exist in loaded file', array('name' => $name, 'file' => $file));
}
}
开发者ID:btweedy,项目名称:foresmo,代码行数:39,代码来源:Class.php
示例7: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_index = Solar_File::load($dir . 'index_info.php');
/**
* Special columns
*/
$this->_serialize_cols[] = 'prefs';
$this->_calculate_cols[] = 'tags_as_string';
/**
* Filters
*/
// make sure the name is unique for its area and model
$where = array('inherit = :inherit', 'area_id = :area_id');
$this->_addFilter('name', 'validateUnique', $where);
// other filters
$this->_addFilter('email', 'validateEmail');
$this->_addFilter('uri', 'validateUri');
$this->_addFilter('editor_ipaddr', 'validateIpv4');
$this->_addFilter('locale', 'validateLocaleCode');
$this->_addFilter('mime', 'validateMimeType');
$this->_addFilter('tags_as_string', 'validateSepWords');
/**
* Relationships.
*/
$this->_belongsTo('area');
$this->_hasMany('taggings');
$this->_hasMany('tags', array('through' => 'taggings'));
}
开发者ID:btweedy,项目名称:foresmo,代码行数:38,代码来源:Nodes.php
示例8: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = $this->_config['prefix'] . Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_hasMany('userinfo', array('foreign_class' => 'Foresmo_Model_UserInfo', 'foreign_key' => 'user_id'));
$this->_hasOne('groups', array('foreign_class' => 'Foresmo_Model_Groups', 'native_col' => 'group_id', 'foreign_col' => 'id'));
}
开发者ID:agentile,项目名称:foresmo,代码行数:15,代码来源:Users.php
示例9: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = $this->_config['prefix'] . Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_hasMany('posts_tags', array('foreign_class' => 'Foresmo_Model_PostsTags', 'foreign_key' => 'tag_id'));
$this->_hasMany('posts', array('foreign_class' => 'Foresmo_Model_Posts', 'through' => 'posts_tags', 'through_key' => 'post_id', 'through_native_col' => 'tag_id', 'through_foreign_col' => 'post_id', 'conditions' => array('status = ?' => array(1))));
}
开发者ID:agentile,项目名称:foresmo,代码行数:15,代码来源:Tags.php
示例10: setup
public function setup()
{
// easier to do this here than as a property, since we use functions.
$this->_config = array('adapters' => array(array('adapter' => 'Solar_Log_Adapter_File', 'events' => 'debug', 'file' => Solar_File::tmp('test_solar_log_adapter_multi.debug.log'), 'format' => '%e %m'), array('adapter' => 'Solar_Log_Adapter_File', 'events' => 'info, notice', 'file' => Solar_File::tmp('test_solar_log_adapter_multi.other.log'), 'format' => '%e %m')));
parent::setup();
@unlink($this->_config['adapters'][0]['file']);
@unlink($this->_config['adapters'][1]['file']);
}
开发者ID:btweedy,项目名称:foresmo,代码行数:8,代码来源:MultiTest.php
示例11: _setup
/**
*
* Model setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_model_name = 'users';
$this->_index = array('created', 'updated', 'handle' => 'unique');
}
开发者ID:btweedy,项目名称:foresmo,代码行数:15,代码来源:Users.php
示例12: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = $this->_config['prefix'] . Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_belongsTo('tags', array('foreign_key' => 'id'));
$this->_belongsTo('posts', array('foreign_key' => 'id'));
}
开发者ID:agentile,项目名称:foresmo,代码行数:15,代码来源:PostsTags.php
示例13: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = $this->_config['prefix'] . Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_hasMany('comments');
$this->_hasMany('permissions', array('through' => 'groupspermissions'));
}
开发者ID:btweedy,项目名称:foresmo,代码行数:15,代码来源:Groups.php
示例14: testCallbacks_instanceMethod
public function testCallbacks_instanceMethod()
{
$file = Solar_Class::dir('Mock_Solar') . 'callbacks-instance-method.php';
Solar_File::load($file);
$instance = Solar::factory('Solar_Callbacks_Instance_Method');
Solar::callbacks(array(array($instance, 'callback')));
$this->assertTrue($GLOBALS['SOLAR_CALLBACKS_INSTANCE_METHOD']);
}
开发者ID:agentile,项目名称:foresmo,代码行数:8,代码来源:Solar.php
示例15: _setup
/**
*
* Model setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_addFilter('email', 'validateEmail');
$this->_addFilter('uri', 'validateUri');
$this->_index_info = array('created', 'updated', 'email' => 'unique', 'uri');
}
开发者ID:kalkin,项目名称:solarphp,代码行数:16,代码来源:TestSolarFoo.php
示例16: _setup
/**
*
* Model setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_model_name = 'tags';
$this->_hasMany('taggings');
$this->_hasMany('nodes', array('through' => 'taggings'));
$this->_index = array('name' => 'unique');
}
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:17,代码来源:Tags.php
示例17: _setup
/**
*
* Model setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_model_name = 'areas';
$this->_hasMany('nodes');
$this->_belongsTo('user');
$this->_index = array('created', 'updated', 'user_id');
}
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:17,代码来源:Areas.php
示例18: _setup
/**
*
* Model setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_model_name = 'taggings';
$this->_belongsTo('node');
$this->_belongsTo('tag');
$this->_index = array('node_id', 'tag_id');
}
开发者ID:btweedy,项目名称:foresmo,代码行数:17,代码来源:Taggings.php
示例19: _setup
/**
*
* Model setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
// recognize sequence columns
$this->_sequence_cols = array('seq_foo' => 'test_solar_foo', 'seq_bar' => 'test_solar_bar');
// recognize serialize columns
$this->_serialize_cols = 'serialize';
}
开发者ID:kalkin,项目名称:solarphp,代码行数:17,代码来源:TestSolarSpecialCols.php
示例20: _setup
/**
*
* Model-specific setup.
*
* @return void
*
*/
protected function _setup()
{
$dir = str_replace('_', DIRECTORY_SEPARATOR, __CLASS__) . DIRECTORY_SEPARATOR . 'Setup' . DIRECTORY_SEPARATOR;
$this->_table_name = $this->_config['prefix'] . Solar_File::load($dir . 'table_name.php');
$this->_table_cols = Solar_File::load($dir . 'table_cols.php');
$this->_hasMany('postinfo', array('foreign_class' => 'Foresmo_Model_PostInfo', 'foreign_key' => 'post_id'));
$this->_hasMany('comments', array('foreign_class' => 'Foresmo_Model_Comments', 'foreign_key' => 'post_id'));
$this->_hasMany('posts_tags', array('foreign_class' => 'Foresmo_Model_PostsTags', 'foreign_key' => 'post_id'));
$this->_hasMany('tags', array('foreign_class' => 'Foresmo_Model_Tags', 'through' => 'posts_tags', 'through_key' => 'tag_id'));
$this->_hasOne('users', array('foreign_class' => 'Foresmo_Model_Users', 'cols' => array('id', 'username', 'email'), 'native_col' => 'user_id', 'foreign_col' => 'id'));
}
开发者ID:btweedy,项目名称:foresmo,代码行数:18,代码来源:Posts.php
注:本文中的Solar_File类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论