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


PHP stripSuffix函数代码示例

本文整理汇总了PHP中stripSuffix函数的典型用法代码示例。如果您正苦于以下问题:PHP stripSuffix函数的具体用法?PHP stripSuffix怎么用?PHP stripSuffix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: zp_register_filter

/**
 * Registers a filtering function
 * Filtering functions are used to post process zenphoto elements or to trigger functions when a filter occur
 *
 * Typical use:
 *
 *		zp_register_filter('some_hook', 'function_handler_for_hook');
 *
 * global array $_zp_filters Storage for all of the filters
 * @param string $hook the name of the zenphoto element to be filtered
 * @param callback $function_name the name of the function that is to be called.
 * @param integer $priority optional. Used to specify the order in which the functions associated with a particular
 * 																		action are executed (default=5, lower=earlier execution, and functions with
 * 																		the same priority are executed in the order in which they were added to the filter)
 * @param int $accepted_args optional. The number of arguments the function accept (default is the number provided).
 */
function zp_register_filter($hook, $function_name, $priority = NULL, $accepted_args = NULL)
{
    global $_zp_filters, $_EnabledPlugins;
    $bt = @debug_backtrace();
    if (is_array($bt)) {
        $b = array_shift($bt);
        $base = basename($b['file']);
    } else {
        $base = 'unknown';
    }
    if (is_null($priority)) {
        $priority = @$_EnabledPlugins[stripSuffix($base)];
        if (is_null($priority)) {
            $priority = 5;
        } else {
            $priority = $priority & PLUGIN_PRIORITY;
        }
    }
    // At this point, we cannot check if the function exists, as it may well be defined later (which is OK)
    $id = zp_filter_unique_id($hook, $function_name, $priority);
    $_zp_filters[$hook][$priority][$id] = array('function' => $function_name, 'accepted_args' => $accepted_args, 'script' => $base);
    if (DEBUG_FILTERS) {
        debugLog($base . '=>' . $function_name . ' registered to ' . $hook . ' at priority ' . $priority);
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:41,代码来源:functions-filter.php

示例2: zipAddAlbum

function zipAddAlbum($album, $base, $zip)
{
    global $_zp_zip_list, $zip_gallery;
    $albumbase = '.' . substr($album->name, $base) . '/';
    foreach ($album->sidecars as $suffix) {
        $f = $albumbase . $album->name . '.' . $suffix;
        if (file_exists($f)) {
            $_zp_zip_list[] = $f;
        }
    }
    $images = $album->getImages();
    foreach ($images as $imagename) {
        $image = newImage($album, $imagename);
        $_zp_zip_list[] = $albumbase . $image->filename;
        $imagebase = stripSuffix($image->filename);
        foreach ($image->sidecars as $suffix) {
            $f = $albumbase . $imagebase . '.' . $suffix;
            if (file_exists($f)) {
                $_zp_zip_list[] = $f;
            }
        }
    }
    $albums = $album->getAlbums();
    foreach ($albums as $albumname) {
        $subalbum = new Album($zip_gallery, $albumname);
        if ($subalbum->exists && !$album->isDynamic()) {
            zipAddAlbum($subalbum, $base, $zip);
        }
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:30,代码来源:album-zip.php

示例3: __construct

 function __construct()
 {
     foreach (getPluginFiles('*.php') as $extension => $plugin) {
         $deprecated = stripSuffix($plugin) . '/deprecated-functions.php';
         if (file_exists($deprecated)) {
             $plugin = basename(dirname($deprecated));
             $content = preg_replace('~#.*function~', '', file_get_contents($deprecated));
             //	remove the comments!
             preg_match_all('~@deprecated\\s+.*since\\s+.*(\\d+\\.\\d+\\.\\d+)~', $content, $versions);
             preg_match_all('/([public static|static]*)\\s*function\\s+(.*)\\s?\\(.*\\)\\s?\\{/', $content, $functions);
             if ($plugin == 'deprecated-functions') {
                 $plugin = 'core';
                 $suffix = '';
             } else {
                 $suffix = ' (' . $plugin . ')';
             }
             foreach ($functions[2] as $key => $function) {
                 if ($functions[1][$key]) {
                     $flag = '_method';
                     $star = '*';
                 } else {
                     $star = $flag = '';
                 }
                 $name = $function . $star . $suffix;
                 $option = 'deprecated_' . $plugin . '_' . $function . $flag;
                 setOptionDefault($option, 1);
                 $this->unique_functions[strtolower($function)] = $this->listed_functions[$name] = array('plugin' => $plugin, 'function' => $function, 'class' => trim($functions[1][$key]), 'since' => @$versions[1][$key], 'option' => $option, 'multiple' => array_key_exists($function, $this->unique_functions));
             }
         }
     }
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:deprecated-functions.php

示例4: iconColor

function iconColor($icon)
{
    global $themeColor;
    if (getOption('css_style') == 'dark') {
        $icon = stripSuffix($icon) . '-white.png';
    }
    return $icon;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:8,代码来源:functions.php

示例5: storeConfig

/**
 * backs-up and updates the Zenphoto configuration file
 *
 * @param string $zp_cfg
 */
function storeConfig($zp_cfg)
{
    debugLogBacktrace(gettext('Updating the configuration file'));
    $mod = fileperms(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE) & 0777;
    @rename(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, $backkup = SERVERPATH . '/' . DATA_FOLDER . '/' . stripSuffix(CONFIGFILE) . '.bak.php');
    @chmod($backup, $mod);
    file_put_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, $zp_cfg);
    @chmod($backup, SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE, $mod);
}
开发者ID:rb26,项目名称:zenphoto,代码行数:14,代码来源:functions-config.php

示例6: storeConfig

/**
 * backs-up and updates the configuration file
 *
 * @param string $zp_cfg
 */
function storeConfig($zp_cfg, $folder = NULL)
{
    if (is_null($folder)) {
        $folder = SERVERPATH . '/';
    }
    $mod = fileperms($folder . DATA_FOLDER . '/' . CONFIGFILE) & 0777;
    @rename($folder . DATA_FOLDER . '/' . CONFIGFILE, $backkup = $folder . DATA_FOLDER . '/' . stripSuffix(CONFIGFILE) . '.bak.php');
    @chmod($backup, $mod);
    file_put_contents($folder . DATA_FOLDER . '/' . CONFIGFILE, $zp_cfg);
    clearstatcache();
    @chmod($folder . DATA_FOLDER . '/' . CONFIGFILE, $mod);
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:17,代码来源:functions-config.php

示例7: getImageProcessorURIFromCacheName

function getImageProcessorURIFromCacheName($match, $watermarks)
{
    $args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
    $set = array();
    $done = false;
    $params = explode('_', stripSuffix($match));
    while (!$done && count($params) > 1) {
        $check = array_pop($params);
        if (is_numeric($check) && !isset($set['w']) && !isset($set['h'])) {
            $set['s'] = $check;
            break;
        } else {
            $c = substr($check, 0, 1);
            if ($c == 'w' || $c == 'h') {
                if (is_numeric($v = substr($check, 1))) {
                    $set[$c] = (int) $v;
                    continue;
                }
            }
            if ($c == 'c') {
                $c = substr($check, 0, 2);
                if (is_numeric($v = substr($check, 2))) {
                    $set[$c] = (int) $v;
                    continue;
                }
            }
            if (!isset($set['w']) && !isset($set['h']) && !isset($set['s'])) {
                if (!isset($set['wm']) && in_array($check, $watermarks)) {
                    $set['wmk'] = $check;
                } else {
                    if ($check == 'thumb') {
                        $set['t'] = true;
                    } else {
                        $set['effects'] = $check;
                    }
                }
            } else {
                array_push($params, $check);
                break;
            }
        }
    }
    if (!isset($set['wmk'])) {
        $set['wmk'] = '!';
    }
    $image = preg_replace('~.*/' . CACHEFOLDER . '/~', '', implode('_', $params)) . '.' . getSuffix($match);
    //	strip out the obfustication
    $album = dirname($image);
    $image = preg_replace('~^[0-9a-f]{' . CACHE_HASH_LENGTH . '}\\.~', '', basename($image));
    $image = $album . '/' . $image;
    return array($image, getImageArgs($set));
}
开发者ID:rb26,项目名称:zenphoto,代码行数:52,代码来源:functions.php

示例8: getOptionsSupported

 function getOptionsSupported()
 {
     global $_zp_gallery;
     $options = array(gettext('Minimum items') => array('key' => 'bxslider_minitems', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("The minimum number of slides to be shown. Slides will be sized down if carousel becomes smaller than the original size."), 'order' => 1), gettext('Maximum items') => array('key' => 'bxslider_maxitems', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("The maximum number of slides to be shown. Slides will be sized up if carousel becomes larger than the original size."), 'order' => 2), gettext('Width') => array('key' => 'bxslider_width', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Width of the thumb. Note that the CSS might need to be adjusted."), 'order' => 3), gettext('Height') => array('key' => 'bxslider_height', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Height of the thumb. Note that the CSS might need to be adjusted."), 'order' => 4), gettext('Crop width') => array('key' => 'bxslider_cropw', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => "", 'order' => 5), gettext('Crop height') => array('key' => 'bxslider_croph', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => "", 'order' => 6), gettext('Speed') => array('key' => 'bxslider_speed', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("The speed in miliseconds the slides advance when clicked.)"), 'order' => 7), gettext('Full image link') => array('key' => 'bxslider_fullimagelink', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("If checked the thumbs link to the full image instead of the image page."), 'order' => 8), gettext('Mode') => array('key' => 'bxslider_mode', 'type' => OPTION_TYPE_SELECTOR, 'selections' => array(gettext('Horizontal') => "horizontal", gettext('Vertical') => "vertical", gettext('Fade') => "fade"), 'desc' => gettext("The mode of the thumb nav. Note this might require theme changes."), 'order' => 9));
     foreach (getThemeFiles(array('404.php', 'themeoptions.php', 'theme_description.php', 'functions.php', 'password.php', 'sidebar.php', 'register.php', 'contact.php')) as $theme => $scripts) {
         $list = array();
         foreach ($scripts as $script) {
             $list[$script] = 'bxslider_' . $theme . '_' . stripSuffix($script);
         }
         $options[$theme] = array('key' => 'bxslider_' . $theme . '_scripts', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'checkboxes' => $list, 'desc' => gettext('The scripts for which BxSlider is enabled. {If themes require it they might set this, otherwise you need to do it manually!}'));
     }
     return $options;
 }
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:13,代码来源:bxslider_thumb_nav.php

示例9: getOptionsSupported

 function getOptionsSupported()
 {
     global $_zp_gallery;
     $options = array(gettext('Thumbs number') => array('key' => 'jcarousel_scroll', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("The number of thumbs to scroll by. Note that the CSS might need to be adjusted.")), gettext('width') => array('key' => 'jcarousel_width', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Width of the carousel. Note that the CSS might need to be adjusted.")), gettext('height') => array('key' => 'jcarousel_height', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => gettext("Height of the carousel. Note that the CSS might need to be adjusted.")), gettext('Crop width') => array('key' => 'jcarousel_cropw', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => ""), gettext('Crop height') => array('key' => 'jcarousel_croph', 'type' => OPTION_TYPE_TEXTBOX, 'desc' => ""), gettext('Full image link') => array('key' => 'jcarousel_fullimagelink', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("If checked the thumbs link to the full image instead of the image page.")), gettext('Vertical') => array('key' => 'jcarousel_vertical', 'type' => OPTION_TYPE_CHECKBOX, 'desc' => gettext("If checked the carousel will flow vertically instead of the default horizontal. Changing this may require theme changes!")));
     foreach (getThemeFiles(array('404.php', 'themeoptions.php', 'theme_description.php', 'functions.php', 'password.php', 'sidebar.php', 'register.php', 'contact.php')) as $theme => $scripts) {
         $list = array();
         foreach ($scripts as $script) {
             $list[$script] = 'jcarousel_' . $theme . '_' . stripSuffix($script);
         }
         $options[$theme] = array('key' => 'jcarousel_' . $theme . '_scripts', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'checkboxes' => $list, 'desc' => gettext('The scripts for which jCarousel is enabled. {If themes require it they might set this, otherwise you need to do it manually!}'));
     }
     return $options;
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:13,代码来源:jcarousel_thumb_nav.php

示例10: __construct

 function __construct($folder8, $cache = true, $quiet = false)
 {
     $folder8 = trim($folder8, '/');
     $folderFS = internalToFilesystem($folder8);
     $localpath = ALBUM_FOLDER_SERVERPATH . $folderFS;
     $this->linkname = $this->name = $folder8;
     $this->localpath = rtrim($localpath, '/');
     if (!($this->exists = AlbumBase::albumCheck($folder8, $folderFS, $quiet, !file_exists($this->localpath) || is_dir($this->localpath)))) {
         return;
     }
     $data = explode("\n", file_get_contents($localpath));
     foreach ($data as $param) {
         $parts = explode('=', $param);
         switch (trim($parts[0])) {
             case 'USER':
                 $owner = trim($parts[1]);
                 break;
             case 'TITLE':
                 $this->instance = trim($parts[1]);
                 break;
             case 'THUMB':
                 $this->set('thumb', trim($parts[1]));
                 break;
         }
     }
     $new = $this->instantiate('albums', array('folder' => $this->name), 'folder', $cache);
     $title = $this->getTitle('all');
     $desc = $this->getDesc('all');
     parent::__construct($owner);
     $this->exists = true;
     if (!is_dir(stripSuffix($this->localpath))) {
         $this->linkname = stripSuffix($folder8);
     }
     $this->name = $folder8;
     $this->setTitle($title);
     $this->setDesc($desc);
     if ($new) {
         $title = $this->get('title');
         $this->set('title', stripSuffix($title));
         // Strip the suffix
         $this->setDateTime(strftime('%Y-%m-%d %H:%M:%S', $this->get('mtime')));
         $this->save();
         zp_apply_filter('new_album', $this);
     }
     zp_apply_filter('album_instantiate', $this);
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:46,代码来源:favoritesAlbums.php

示例11: getOptionsSupported

 function getOptionsSupported()
 {
     global $_zp_gallery;
     $themes = getPluginFiles('colorbox_js/themes/*.*');
     $list = array('Custom (theme based)' => 'custom');
     foreach ($themes as $theme) {
         $theme = stripSuffix(basename($theme));
         $list[ucfirst($theme)] = $theme;
     }
     $opts = array(gettext('Colorbox theme') => array('key' => 'colorbox_theme', 'type' => OPTION_TYPE_SELECTOR, 'order' => 0, 'selections' => $list, 'desc' => gettext("The Colorbox script comes with 5 example themes you can select here. If you select <em>custom (within theme)</em> you need to place a folder <em>colorbox_js</em> containing a <em>colorbox.css</em> file and a folder <em>images</em> within the current theme to override to use a custom Colorbox theme.")));
     $c = 1;
     foreach (getThemeFiles(array('404.php', 'themeoptions.php', 'theme_description.php')) as $theme => $scripts) {
         $list = array();
         foreach ($scripts as $script) {
             $list[$script] = 'colorbox_' . $theme . '_' . stripSuffix($script);
         }
         $opts[$theme] = array('key' => 'colorbox_' . $theme . '_scripts', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'order' => $c++, 'checkboxes' => $list, 'desc' => gettext('The scripts for which Colorbox is enabled. {Should have been set by the themes!}'));
     }
     return $opts;
 }
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:20,代码来源:colorbox_js.php

示例12: getOptionsSupported

 function getOptionsSupported()
 {
     $gallery = new Gallery();
     $opts = array();
     $exclude = array('404.php', 'themeoptions.php', 'theme_description.php');
     foreach (array_keys($gallery->getThemes()) as $theme) {
         $curdir = getcwd();
         $root = SERVERPATH . '/' . THEMEFOLDER . '/' . $theme . '/';
         chdir($root);
         $filelist = safe_glob('*.php');
         $list = array();
         foreach ($filelist as $file) {
             if (!in_array($file, $exclude)) {
                 $list[$script = stripSuffix(filesystemToInternal($file))] = 'colorbox_' . $theme . '_' . $script;
             }
         }
         chdir($curdir);
         $opts[$theme] = array('key' => 'colorbox_' . $theme . '_scripts', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'checkboxes' => $list, 'desc' => gettext('The scripts for which Colorbox is enabled. {Should have been set by the themes!}'));
     }
     return $opts;
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:21,代码来源:colorbox.php

示例13: array

$personalities = array();
foreach ($persona as $personality) {
    if (file_exists(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/' . $personality . '/functions.php')) {
        $personalities[ucfirst(str_replace('_', ' ', $personality))] = $personality;
    }
}
$personality = strtolower(getOption('effervescence_personality'));
if (!in_array($personality, $personalities)) {
    $persona = $personalities;
    $personality = array_shift($persona);
}
chdir(SERVERPATH . "/themes/" . basename(dirname(__FILE__)) . "/styles");
$filelist = safe_glob('*.txt');
$themecolors = array();
foreach ($filelist as $file) {
    $themecolors[basename($file)] = stripSuffix(filesystemToInternal($file));
}
chdir($cwd);
if (!OFFSET_PATH) {
    if (extensionEnabled('themeSwitcher')) {
        $themeColor = getOption('themeSwitcher_effervescence_color');
        if (isset($_GET['themeColor'])) {
            $new = $_GET['themeColor'];
            if (in_array($new, $themecolors)) {
                setOption('themeSwitcher_effervescence_color', $new);
                $themeColor = $new;
            }
        }
        if (!$themeColor) {
            $themeColor = getThemeOption('Theme_colors');
        }
开发者ID:rb26,项目名称:zenphoto,代码行数:31,代码来源:functions.php

示例14: zp_apply_filter

     $album->setOwner($_zp_current_admin_obj->getUser());
     $album->save();
 }
 @chmod($targetPath, CHMOD_VALUE);
 $error = zp_apply_filter('check_upload_quota', UPLOAD_ERR_OK, $tempFile);
 if (!$error) {
     if (is_valid_image($name) || is_valid_other_type($name)) {
         $seoname = seoFriendly($name);
         if (strrpos($seoname, '.') === 0) {
             $seoname = sha1($name) . $seoname;
         }
         // soe stripped out all the name.
         $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
         if (file_exists($targetFile)) {
             $append = '_' . time();
             $seoname = stripSuffix($seoname) . $append . '.' . getSuffix($seoname);
             $targetFile = $targetPath . '/' . internalToFilesystem($seoname);
         }
         if (move_uploaded_file($tempFile, $targetFile)) {
             @chmod($targetFile, 0666 & CHMOD_VALUE);
             $album = new Album($gallery, $folder);
             $image = newImage($album, $seoname);
             $image->setOwner($_zp_current_admin_obj->getUser());
             if ($name != $seoname && $image->getTitle() == substr($seoname, 0, strrpos($seoname, '.'))) {
                 $image->setTitle(substr($name, 0, strrpos($name, '.')));
             }
             $image->save();
         } else {
             $error = UPLOAD_ERR_NO_FILE;
         }
     } else {
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:31,代码来源:uploader.php

示例15: buttons

    /**
     * Creates a list of logon buttons for federated logon handlers.
     * Note that it will use an image if one exists. The name of the image
     * should be cononical to the name of the logon handler, but without the "_logon'.
     * The image must be a PNG file.
     *
     * The styling of the buttons is done by the "federated_logon_buttons.css". If you do not like the
     * one provided place an alternate version in your theme folder or the plugins/federated_logon
     * folder.
     */
    static function buttons($redirect = NULL)
    {
        $alt_handlers = federated_logon::alt_login_handler('');
        ?>
		<ul class="logon_buttons">
			<?php 
        foreach ($alt_handlers as $handler => $details) {
            $script = $details['script'];
            $authority = str_replace('_logon', '', stripSuffix(basename($script)));
            if (is_null($redirect)) {
                $details['params'][] = 'redirect=/' . ZENFOLDER . '/admin.php';
            } else {
                if (!empty($redirect)) {
                    $details['params'][] = 'redirect=' . $redirect;
                }
            }
            if (count($details['params'])) {
                $params = "'" . implode("','", $details['params']) . "'";
            } else {
                $params = '';
            }
            ?>
				<li>
					<span class="fed_buttons">
						<a href="javascript:launchScript('<?php 
            echo $script;
            ?>
',[<?php 
            echo $params;
            ?>
]);" title="<?php 
            echo $authority;
            ?>
" >
							<?php 
            $logo = ltrim(str_replace(WEBPATH, '', dirname($script)) . '/' . $authority . '.png', '/');
            if (file_exists(SERVERPATH . '/' . $logo)) {
                ?>
								<img src="<?php 
                echo WEBPATH . '/' . $logo;
                ?>
" alt="<?php 
                echo $authority;
                ?>
" title="<?php 
                printf(gettext('Login using %s'), $authority);
                ?>
" />
								<?php 
            } else {
                echo $authority;
            }
            ?>
						</a>
					</span>
				</li>
				<?php 
        }
        ?>
		</ul>
		<?php 
    }
开发者ID:rb26,项目名称:zenphoto,代码行数:72,代码来源:federated_logon.php


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