本文整理汇总了PHP中JFile::stripExt方法的典型用法代码示例。如果您正苦于以下问题:PHP JFile::stripExt方法的具体用法?PHP JFile::stripExt怎么用?PHP JFile::stripExt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFile
的用法示例。
在下文中一共展示了JFile::stripExt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
$doc = JFactory::getDocument();
JHtml::_('jquery.framework');
$plg_path = JURI::root(true) . '/plugins/system/helix3';
$doc->addScript($plg_path . '/assets/js/spimage.js');
$doc->addStyleSheet($plg_path . '/assets/css/spimage.css');
if ($this->value) {
$class1 = ' hide';
$class2 = '';
} else {
$class1 = '';
$class2 = ' hide';
}
$output = '<div class="sp-image-field clearfix">';
$output .= '<div class="sp-image-upload-wrapper">';
if ($this->value) {
$data_src = $this->value;
$src = JURI::root(true) . '/' . $data_src;
$basename = basename($data_src);
$thumbnail = JPATH_ROOT . '/' . dirname($data_src) . '/' . JFile::stripExt($basename) . '_thumbnail.' . JFile::getExt($basename);
if (file_exists($thumbnail)) {
$src = JURI::root(true) . '/' . dirname($data_src) . '/' . JFile::stripExt($basename) . '_thumbnail.' . JFile::getExt($basename);
}
$output .= '<img src="' . $src . '" data-src="' . $data_src . '" alt="">';
}
$output .= '</div>';
$output .= '<input type="file" class="sp-image-upload" accept="image/*" style="display:none;">';
$output .= '<a class="btn btn-info btn-sp-image-upload' . $class1 . '" href="#"><i class="fa fa-plus"></i> Upload Image</a>';
$output .= '<a class="btn btn-danger btn-sp-image-remove' . $class2 . '" href="#"><i class="fa fa-minus-circle"></i> Remove Image</a>';
$output .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" class="form-field-spimage">';
$output .= '</div>';
return $output;
}
示例2: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
protected function getOptions()
{
// Initialize variables.
$lang = JFactory::getLanguage();
$options = array();
$type = $this->form instanceof JForm ? $this->form->getValue('db_type') : 'mysql';
if ($type == 'mysqli') {
$type='mysql';
}
// Get a list of files in the search path with the given filter.
$files = JFolder::files(JPATH_INSTALLATION.'/sql/'.$type, '^sample.*\.sql$');
// Build the options list from the list of files.
if (is_array($files)) {
foreach ($files as $file)
{
$options[] = JHtml::_('select.option', $file, $lang->hasKey($key = 'INSTL_'.($file=JFile::stripExt($file)).'_SET')?JText::_($key):$file);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例3: FileName2ClassName
static function FileName2ClassName($prefix,$filename,$suffix) {
jimport('joomla.filesystem.file');
$class_name= $prefix.ucfirst(strtolower(preg_replace('/\s/','_', JFile::stripExt($filename)))).$suffix;
return $class_name;
}
示例4: loadManifestFromXML
/**
* Load a manifest from an XML file
*
* @param string $xmlpath Path to XML manifest file
*
* @return boolean Result of load
* @since 1.6
*/
function loadManifestFromXML($xmlfile)
{
$this->manifest_file = JFile::stripExt(basename($xmlfile));
$xml = JFactory::getXML($xmlfile);
if (!$xml) {
$this->_errors[] = JText::sprintf('JLIB_INSTALLER_ERROR_LOAD_XML', $xmlfile);
return false;
} else {
$this->name = (string) $xml->name;
$this->packagename = (string) $xml->packagename;
$this->update = (string) $xml->update;
$this->authorurl = (string) $xml->authorUrl;
$this->author = (string) $xml->author;
$this->authoremail = (string) $xml->authorEmail;
$this->description = (string) $xml->description;
$this->packager = (string) $xml->packager;
$this->packagerurl = (string) $xml->packagerurl;
$this->version = (string) $xml->version;
if (isset($xml->files->file) && count($xml->files->file)) {
foreach ($xml->files->file as $file) {
// NOTE: JExtension doesn't expect a string.
// DO NOT CAST $file
$this->filelist[] = new JExtension($file);
}
}
return true;
}
}
示例5: getThumbnail
/**
* when in form or detailed view, do we want to show the full image or thumbnail/link?
* @param object $params
* @return bool
*/
private function getThumbnail(&$model, &$params, $file)
{
if ($this->inTableView || $params->get('make_thumbnail') == '1' && $params->get('fu_show_image') == 1) {
if (!$params->get('make_thumbnail', false)) {
return false;
} else {
$thumb_url = $model->storage->_getThumb($file);
$thumb_file = $model->storage->urlToPath($thumb_url);
//$thumb_url_info = pathinfo($thumb_url);
//$$$ rob php 5.1 doesnt have filename property in pathinfo so this wont work!
/*if (strtolower($thumb_url_info['extension'] == 'pdf')) {
$thumb_url = $thumb_url_info['dirname'] . '/' . $thumb_url_info['filename'] . '.' . $this->pdf_thumb_type;
$thumb_file_info = pathinfo($thumb_file);
$thumb_file = $thumb_file_info['dirname'] . DS . $thumb_file_info['filename'] . '.' . $this->pdf_thumb_type;
}*/
// all we need is to swap the file extension right? -Hugh?
$ext = JFile::getExt($thumb_file);
if (strtolower($ext) == 'pdf') {
$thumb_file = JFile::stripExt($thumb_file) . '.' . $this->pdf_thumb_type;
$thumb_url = JFile::stripExt($thumb_url) . '.' . $this->pdf_thumb_type;
}
if ($model->storage->exists($thumb_file)) {
return $thumb_url;
} else {
$thumb_file = 'media/com_fabrik/images/pdf.png';
if (JFile::exists(COM_FABRIK_BASE . DS . $thumb_file)) {
return COM_FABRIK_LIVESITE . $thumb_file;
} else {
return false;
}
}
}
}
return false;
}
示例6: getExtensions
function getExtensions($plugin){
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$path = JCE_PLUGINS.DS.$plugin.DS.'extensions';
$extensions = array();
if (JFolder::exists($path)) {
$types = JFolder::folders($path);
foreach ($types as $type) {
$files = JFolder::files($path.DS.$type, '\.xml$');
foreach ($files as $file) {
$object = new StdClass();
$object->folder = $type;
$name = JFile::stripExt($file);
if (JFile::exists($path.DS.$type.DS.$name.'.php')) {
$object->extension = $name;
// Load xml file
$xml =& JFactory::getXMLParser('Simple');
if ($xml->loadFile($path.DS.$type.DS.$file)) {
$root =& $xml->document;
$name = $root->getElementByPath('name');
$object->name = $name->data();
} else {
$object->name = $name;
}
$extensions[] = $object;
}
}
}
}
return $extensions;
}
示例7: loadManifestFromXML
function loadManifestFromXML($xmlfile)
{
$this->manifest_file = JFile::stripExt(basename($xmlfile));
$xml = JFactory::getXML($xmlfile);
if (!$xml) {
$this->_errors[] = 'Failed to load XML File: ' . $xmlfile;
return false;
} else {
$xml = $xml->document;
$this->name = (string) $xml->name;
$this->packagename = (string) $xml->packagename;
$this->update = (string) $xml->update;
$this->authorurl = (string) $xml->authorUrl;
$this->author = (string) $xml->author;
$this->authoremail = (string) $xml->authorEmail;
$this->description = (string) $xml->description;
$this->packager = (string) $xml->packager;
$this->packagerurl = (string) $xml->packagerurl;
$this->version = (string) $xml->version;
if (isset($xml->files->file) && count($xml->files->file)) {
foreach ($xml->files->file as $file) {
$this->filelist[] = new JExtension((string) $file);
}
}
return true;
}
}
示例8: onPromoteList
function onPromoteList($uid)
{
if ($uid) {
$user = JFactory::getUser($uid);
} else {
$user = JFactory::getUser();
}
jimport('joomla.filesystem.file');
$db = JFactory::getDBO();
$name = JFile::getName(__FILE__);
$name = JFile::stripExt($name);
//$name = $this->params->get('plugin_name');
$sobichk = $this->_sobichk();
if (!empty($sobichk)) {
$query = "SELECT CONCAT_WS('|', '" . $name . "', s.itemid) as value, s.title as text FROM #__sobi2_item AS s\n\t\t\t\t\t\t\t\t LEFT JOIN #__users AS u ON s.updating_user = u.id\n\t\t\t\t\t\t\t\t WHERE u.id=" . $user->id . "\n\t\t\t\t\t\t\t\t ORDER BY itemid";
$db->setQuery($query);
$itemlist = $db->loadObjectlist();
if (empty($itemlist)) {
$list[0]->value = $name . '|' . '0';
$list[0]->text = JText::_("NO_SOBILIST");
return $list;
} else {
return $itemlist;
}
}
}
示例9: requireClass
/**
* Require the correct file from step
*
* @return int The total number
*
* @since 3.0.0
*/
public static function requireClass($name, $xmlpath, $class)
{
if (!empty($name)) {
// Loading the JFile class
jimport('joomla.filesystem.file');
$file_core = JPATH_COMPONENT_ADMINISTRATOR . "/includes/schemas/joomla15/{$name}.php";
$file_checks = JPATH_COMPONENT_ADMINISTRATOR . "/includes/extensions/{$name}.php";
// Require the file
if (JFile::exists($file_core)) {
JLoader::register($class, $file_core);
// Checks
} else {
if (JFile::exists($file_checks)) {
JLoader::register($class, $file_checks);
// 3rd party extensions
} else {
if (isset($xmlpath)) {
$phpfile_strip = JFile::stripExt(JPATH_PLUGINS . "/redmigrator/" . $xmlpath);
if (JFile::exists("{$phpfile_strip}.php")) {
JLoader::register($class, "{$phpfile_strip}.php");
}
}
}
}
}
}
示例10: addAutoLoadFolder
function addAutoLoadFolder($folder, $type, $prefix = 'Xipt')
{
foreach (JFolder::files($folder, '.php$') as $file) {
$className = JString::ucfirst($prefix) . JString::ucfirst($type) . JString::ucfirst(JFile::stripExt($file));
JLoader::register($className, $folder . DS . $file);
}
}
示例11: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 1.6
*/
protected function getOptions()
{
$lang = JFactory::getLanguage();
$options = array();
$type = $this->form->getValue('db_type');
// Some database drivers share DDLs; point these drivers to the correct parent
if ($type == 'mysqli' || $type == 'pdomysql') {
$type = 'mysql';
} elseif ($type == 'sqlsrv') {
$type = 'sqlazure';
}
// Get a list of files in the search path with the given filter.
$files = JFolder::files(JPATH_INSTALLATION . '/sql/' . $type, '^sample.*\\.sql$');
$currentLang = $lang->getTag();
// BOF VIRTUEMART
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
if (!class_exists('VmVirtueMart')) {
require JPATH_INSTALLATION . DS . 'helper' . DS . 'virtuemart.php';
}
VmVirtueMart::loadVMLanguage($currentLang);
$sampleNoneText = JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE') . '<br/><strong>' . JText::_('COM_VIRTUEMART_INSTL_SITE_INSTALL_SAMPLE_NONE') . '</strong>';
// Add option to not install sample data.
$options[] = JHtml::_('select.option', '', JHtml::_('tooltip', JText::_('INSTL_SITE_INSTALL_SAMPLE_NONE_DESC'), '', '', $sampleNoneText));
// EOF VIRTUEMART
// Build the options list from the list of files.
if (is_array($files)) {
foreach ($files as $file) {
$options[] = JHtml::_('select.option', $file, $lang->hasKey($key = 'INSTL_' . ($file = JFile::stripExt($file)) . '_SET') ? JHtml::_('tooltip', JText::_('INSTL_' . strtoupper($file = JFile::stripExt($file)) . '_SET_DESC'), '', '', JText::_('INSTL_' . ($file = JFile::stripExt($file)) . '_SET')) : $file);
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例12: thumb
public static function thumb($image, $width, $height, $ratio = false, $uniqid)
{
// remove any / that begins the path
if (substr($image, 0, 1) == '/') {
$image = substr($image, 1);
}
// create a thumb filename
$file_dir = dirname($image);
$thumb_dir = $file_dir . DS . "tzslider_thumbs";
if (!JFolder::exists($thumb_dir)) {
JFolder::create($thumb_dir);
}
$file_name = JFile::stripExt(basename($image));
$file_ext = JFile::getExt($image);
$thumb_path = $thumb_dir . DS . $file_name . '_' . $uniqid . "_thumb." . $file_ext;
// check to see if this file exists, if so we don't need to create it
if (function_exists("gd_info")) {
//Check existing thumbnails dimensions
if (file_exists($thumb_path)) {
$size = GetImageSize($thumb_path);
$currentWidth = $size[0];
$currentHeight = $size[1];
}
//Creating thumbnails
if (!file_exists($thumb_path) || $currentWidth != $width || $currentHeight != $height) {
modTzContentSliderCommonHelper::crop($image, $width, $height, $ratio, $thumb_path);
}
}
return str_replace("\\", "/", $thumb_path);
}
示例13: _displayPopulate
function _displayPopulate($tpl)
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$document = JFactory::getDocument();
$uri = JFactory::getURI();
$url = $uri->toString();
$model = $this->getModel();
$projectws = $this->get('Data', 'project');
$document->setTitle(JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TITLE'));
$lists = array();
$iScheduleType = 0;
$options = array();
$options[] = JHtml::_('select.option', $iScheduleType++, JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_SINGLE_ROUND_ROBIN'));
$options[] = JHtml::_('select.option', $iScheduleType++, JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_DOUBLE_ROUND_ROBIN'));
$path = JPath::clean(JPATH_ROOT . '/images/com_joomleague/database/round_populate_templates');
$files = JFolder::files($path, '.', false);
foreach ($files as $file) {
$filename = strtoupper(JFile::stripExt($file));
$options[] = JHtml::_('select.option', $file, JText::_('COM_JOOMLEAGUE_ADMIN_ROUNDS_POPULATE_TYPE_' . $filename));
}
// $lists['scheduling'] = JHtml::_('select.genericlist', $options, 'scheduling', 'onchange="handleOnChange_scheduling(this)"', 'value', 'text');
$lists['scheduling'] = JHtml::_('select.genericlist', $options, 'scheduling', '', 'value', 'text');
// $teams = $this->get('projectteams');
// $options = array();
// foreach ($teams as $t) {
// $options[] = JHtml::_('select.option', $t->projectteam_id, $t->text);
// }
// $lists['teamsorder'] = JHtml::_('select.genericlist', $options, 'teamsorder[]', 'multiple="multiple" size="20"');
$this->projectws = $projectws;
$this->request_url = $url;
$this->lists = $lists;
$this->addToolbar_Populate();
parent::display($tpl);
}
示例14: fetchElement
/**
* Fetch a filelist element
*
* @param string $name Element name
* @param string $value Element value
* @param JXMLElement &$node JXMLElement node object containing the settings for the element
* @param string $control_name Control name
*
* @return string
*/
public function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
// path to images directory
$path = JPATH_ROOT . '/' . (string) $node->attributes()->directory;
$filter = (string) $node->attributes()->filter;
$exclude = (string) $node->attributes()->exclude;
$stripExt = (string) $node->attributes()->stripext;
$files = JFolder::files($path, $filter);
$options = array();
if (!(string) $node->attributes()->hide_none) {
$options[] = JHtml::_('select.option', '-1', JText::_('JOPTION_DO_NOT_USE'));
}
if (!(string) $node->attributes()->hide_default) {
$options[] = JHtml::_('select.option', '', JText::_('JOPTION_USE_DEFAULT'));
}
if (is_array($files)) {
foreach ($files as $file) {
if ($exclude) {
if (preg_match(chr(1) . $exclude . chr(1), $file)) {
continue;
}
}
if ($stripExt) {
$file = JFile::stripExt($file);
}
$options[] = JHtml::_('select.option', $file, $file);
}
}
return JHtml::_('select.genericlist', $options, $control_name . '[' . $name . ']', array('id' => 'param' . $name, 'list.attr' => 'class="inputbox"', 'list.select' => (string) $value));
}
示例15: fetchElement
function fetchElement($name, $value, &$node, $control_name)
{
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
// path to images directory
$path = JPATH_ROOT . DS . $node->attributes('directory');
$filter = $node->attributes('filter');
$exclude = $node->attributes('exclude');
$stripExt = $node->attributes('stripext');
$files = JFolder::files($path, $filter);
$options = array();
if (!$node->attributes('hide_none')) {
$options[] = JHTML::_('select.option', '-1', '- ' . JText::_('Do not use') . ' -');
}
if (!$node->attributes('hide_default')) {
$options[] = JHTML::_('select.option', '', '- ' . JText::_('Use default') . ' -');
}
if (is_array($files)) {
foreach ($files as $file) {
if ($exclude) {
if (preg_match(chr(1) . $exclude . chr(1), $file)) {
continue;
}
}
if ($stripExt) {
$file = JFile::stripExt($file);
}
$options[] = JHTML::_('select.option', $file, $file);
}
}
return JHTML::_('select.genericlist', $options, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
}