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


PHP confToHash函数代码示例

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


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

示例1: helper_plugin_translation

 /**
  * Initialize
  */
 function helper_plugin_translation()
 {
     global $conf;
     require_once DOKU_INC . 'inc/pageutils.php';
     require_once DOKU_INC . 'inc/utf8.php';
     // load wanted translation into array
     $this->trans = strtolower(str_replace(',', ' ', $this->getConf('translations')));
     $this->trans = array_unique(array_filter(explode(' ', $this->trans)));
     sort($this->trans);
     // load language names
     $this->LN = confToHash(dirname(__FILE__) . '/lang/langnames.txt');
     // display options
     $this->opts = $this->getConf('display');
     $this->opts = explode(',', $this->opts);
     $this->opts = array_map('trim', $this->opts);
     $this->opts = array_fill_keys($this->opts, true);
     // get default translation
     if (!$conf['lang_before_translation']) {
         $dfl = $conf['lang'];
     } else {
         $dfl = $conf['lang_before_translation'];
     }
     if (in_array($dfl, $this->trans)) {
         $this->defaultlang = $dfl;
     } else {
         $this->defaultlang = '';
         array_unshift($this->trans, '');
     }
     $this->tns = cleanID($this->getConf('translationns'));
     if ($this->tns) {
         $this->tns .= ':';
     }
 }
开发者ID:amondot,项目名称:dokuwiki_ynh,代码行数:36,代码来源:helper.php

示例2: handle_start

 /**
  * handle event
  */
 function handle_start(&$event, $param)
 {
     global $ID;
     global $ACT;
     if ($ACT != 'show') {
         return;
     }
     $redirects = confToHash($this->getsavedir() . '/shorturl.conf');
     if ($redirects[$ID]) {
         if (preg_match('/^https?:\\/\\//', $redirects[$ID])) {
             send_redirect($redirects[$ID]);
         } else {
             if ($this->getConf('showmsg')) {
                 msg(sprintf($this->getLang('redirected'), hsc($ID)));
             }
             send_redirect(wl($redirects[$ID], '', true));
         }
         exit;
     } else {
         if ($_GET['generateShortURL'] != "" && auth_quickaclcheck($ID) >= AUTH_READ) {
             $shorturl =& plugin_load('helper', 'shorturl');
             if ($shorturl) {
                 $shortID = $shorturl->autoGenerateShortUrl($ID);
             }
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:30,代码来源:action.php

示例3: getInfo

 /**
  * for backward compatability
  * @see inc/DokuWiki_Plugin#getInfo()
  */
 function getInfo()
 {
     if (method_exists(parent, 'getInfo')) {
         $info = parent::getInfo();
     }
     return is_array($info) ? $info : confToHash(dirname(__FILE__) . '/plugin.info.txt');
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:11,代码来源:admin.php

示例4: getAttributes

 /**
  * get attributes (pull apart the string between '<wrap' and '>')
  *  and identify classes, width, lang and dir
  *
  * @author Anika Henke <anika@selfthinker.org>
  * @author Christopher Smith <chris@jalakai.co.uk>
  *   (parts taken from http://www.dokuwiki.org/plugin:box)
  */
 function getAttributes($data)
 {
     $attr = array();
     $tokens = preg_split('/\\s+/', $data, 9);
     $noPrefix = array_map('trim', explode(",", $this->getConf('noPrefix')));
     foreach ($tokens as $token) {
         //get width
         if (preg_match('/^\\d*\\.?\\d+(%|px|em|ex|pt|pc|cm|mm|in)$/', $token)) {
             $attr['width'] = $token;
             continue;
         }
         //get lang
         if (preg_match('/\\:([a-z\\-]+)/', $token)) {
             $attr['lang'] = trim($token, ':');
             continue;
         }
         //get classes
         //restrict token (class names) characters to prevent any malicious data
         if (preg_match('/[^A-Za-z0-9_-]/', $token)) {
             continue;
         }
         $prefix = in_array($token, $noPrefix) ? '' : 'wrap_';
         $attr['class'] = (isset($attr['class']) ? $attr['class'] . ' ' : '') . $prefix . $token;
     }
     //get dir
     if ($attr['lang']) {
         $lang2dirFile = dirname(__FILE__) . '/conf/lang2dir.conf';
         if (@file_exists($lang2dirFile)) {
             $lang2dir = confToHash($lang2dirFile);
             $attr['dir'] = strtr($attr['lang'], $lang2dir);
         }
     }
     return $attr;
 }
开发者ID:nitcalicut,项目名称:Nakshatra-Wiki,代码行数:42,代码来源:helper.php

示例5: getAttributes

 /**
  * get attributes (pull apart the string between '<wrap' and '>')
  *  and identify classes, width, lang and dir
  *
  * @author Anika Henke <anika@selfthinker.org>
  * @author Christopher Smith <chris@jalakai.co.uk>
  *   (parts taken from http://www.dokuwiki.org/plugin:box)
  */
 function getAttributes($data)
 {
     $attr = array();
     $tokens = preg_split('/\\s+/', $data, 9);
     $noPrefix = array_map('trim', explode(',', $this->getConf('noPrefix')));
     $restrictedClasses = $this->getConf('restrictedClasses');
     if ($restrictedClasses) {
         $restrictedClasses = array_map('trim', explode(',', $this->getConf('restrictedClasses')));
     }
     $restrictionType = $this->getConf('restrictionType');
     foreach ($tokens as $token) {
         //get width
         if (preg_match('/^\\d*\\.?\\d+(%|px|em|ex|pt|pc|cm|mm|in)$/', $token)) {
             $attr['width'] = $token;
             continue;
         }
         //get lang
         if (preg_match('/\\:([a-z\\-]+)/', $token)) {
             $attr['lang'] = trim($token, ':');
             continue;
         }
         //get id
         if (preg_match('/#([A-Za-z0-9_-]+)/', $token)) {
             $attr['id'] = trim($token, '#');
             continue;
         }
         //get classes
         //restrict token (class names) characters to prevent any malicious data
         if (preg_match('/[^A-Za-z0-9_-]/', $token)) {
             continue;
         }
         if ($restrictedClasses) {
             $classIsInList = in_array(trim($token), $restrictedClasses);
             // either allow only certain classes
             if ($restrictionType) {
                 if (!$classIsInList) {
                     continue;
                 }
                 // or disallow certain classes
             } else {
                 if ($classIsInList) {
                     continue;
                 }
             }
         }
         $prefix = in_array($token, $noPrefix) ? '' : 'wrap_';
         $attr['class'] = (isset($attr['class']) ? $attr['class'] . ' ' : '') . $prefix . $token;
     }
     //get dir
     if ($attr['lang']) {
         $lang2dirFile = dirname(__FILE__) . '/conf/lang2dir.conf';
         if (@file_exists($lang2dirFile)) {
             $lang2dir = confToHash($lang2dirFile);
             $attr['dir'] = strtr($attr['lang'], $lang2dir);
         }
     }
     return $attr;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:66,代码来源:helper.php

示例6: getInfo

 /**
  * General Info
  *
  * Needs to return a associative array with the following values:
  *
  * author - Author of the plugin
  * email  - Email address to contact the author
  * date   - Last modified date of the plugin in YYYY-MM-DD format
  * name   - Name of the plugin
  * desc   - Short description of the plugin (Text only)
  * url    - Website with more information on the plugin (eg. syntax description)
  */
 function getInfo()
 {
     $parts = explode('_', get_class($this));
     $info = DOKU_PLUGIN . '/' . $parts[2] . '/plugin.info.txt';
     if (@file_exists($info)) {
         return confToHash($info);
     }
     trigger_error('getInfo() not implemented in ' . get_class($this) . ' and ' . $info . ' not found', E_USER_WARNING);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:21,代码来源:syntax.php

示例7: getInfo

 /**
  * General Info
  *
  * Needs to return a associative array with the following values:
  *
  * base   - the plugin's base name (eg. the directory it needs to be installed in)
  * author - Author of the plugin
  * email  - Email address to contact the author
  * date   - Last modified date of the plugin in YYYY-MM-DD format
  * name   - Name of the plugin
  * desc   - Short description of the plugin (Text only)
  * url    - Website with more information on the plugin (eg. syntax description)
  */
 function getInfo()
 {
     $parts = explode('_', get_class($this));
     $info = DOKU_PLUGIN . '/' . $parts[2] . '/plugin.info.txt';
     if (@file_exists($info)) {
         return confToHash($info);
     }
     msg('getInfo() not implemented in ' . get_class($this) . ' and ' . $info . ' not found.<br />This is a bug in the ' . $parts[2] . ' plugin and should be reported to the ' . 'plugin author.', -1);
     return array('date' => '0000-00-00', 'name' => $parts[2] . ' plugin');
 }
开发者ID:rodrigoaustincascao,项目名称:Service-Desk-IMC,代码行数:23,代码来源:plugin.php

示例8: getInfo

 /**
  * General Info
  *
  * Needs to return a associative array with the following values:
  *
  * base   - the plugin's base name (eg. the directory it needs to be installed in)
  * author - Author of the plugin
  * email  - Email address to contact the author
  * date   - Last modified date of the plugin in YYYY-MM-DD format
  * name   - Name of the plugin
  * desc   - Short description of the plugin (Text only)
  * url    - Website with more information on the plugin (eg. syntax description)
  */
 function getInfo()
 {
     $parts = explode('_', get_class($this));
     $info = DOKU_PLUGIN . '/' . $parts[2] . '/plugin.info.txt';
     if (@file_exists($info)) {
         return confToHash($info);
     }
     msg('getInfo() not implemented in ' . get_class($this) . ' and ' . $info . ' not found.<br />' . 'Verify you\'re running the latest version of the plugin. If the problem persists, send a ' . 'bug report to the author of the ' . $parts[2] . ' plugin.', -1);
     return array('date' => '0000-00-00', 'name' => $parts[2] . ' plugin');
 }
开发者ID:ermlv,项目名称:dokuwiki,代码行数:23,代码来源:plugin.php

示例9: test_plugininfo

 /**
  * Simple test to make sure the plugin.info.txt is in correct format
  */
 public function test_plugininfo()
 {
     $file = __DIR__ . '/../plugin.info.txt';
     $this->assertFileExists($file);
     $info = confToHash($file);
     $this->assertArrayHasKey('base', $info);
     $this->assertArrayHasKey('author', $info);
     $this->assertArrayHasKey('email', $info);
     $this->assertArrayHasKey('date', $info);
     $this->assertArrayHasKey('name', $info);
     $this->assertArrayHasKey('desc', $info);
     $this->assertArrayHasKey('url', $info);
     $this->assertEquals('svgpureinsert', $info['base']);
     $this->assertRegExp('/^https?:\\/\\//', $info['url']);
     $this->assertTrue(mail_isvalid($info['email']));
     $this->assertRegExp('/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/', $info['date']);
     $this->assertTrue(false !== strtotime($info['date']));
 }
开发者ID:xudianyang,项目名称:wiki.phpboy.net,代码行数:21,代码来源:general.test.php

示例10: handle_start

 /**
  * handle event
  */
 function handle_start(&$event, $param)
 {
     global $ID;
     global $ACT;
     if ($ACT != 'show') {
         return;
     }
     $redirects = confToHash(dirname(__FILE__) . '/redirect.conf');
     if ($redirects[$ID]) {
         if (preg_match('/^https?:\\/\\//', $redirects[$ID])) {
             send_redirect($redirects[$ID]);
         } else {
             if ($this->getConf('showmsg')) {
                 msg(sprintf($this->getLang('redirected'), hsc($ID)));
             }
             $link = explode('#', $redirects[$ID], 2);
             send_redirect(wl($link[0], '', true) . '#' . rawurlencode($link[1]));
         }
         exit;
     }
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-redirect,代码行数:24,代码来源:action.php

示例11: getInfo

 /**
  * Returns some info
  */
 function getInfo()
 {
     return confToHash(DOKU_PLUGIN . 'emaildigest/plugin.info.txt');
 }
开发者ID:kazmiya,项目名称:dokuwiki-plugin-emaildigest,代码行数:7,代码来源:action.php

示例12: getInfo

 public function getInfo()
 {
     return confToHash(dirname(__FILE__) . '/plugin.info.txt');
 }
开发者ID:elaratain,项目名称:database2,代码行数:4,代码来源:syntax.php

示例13: getInfo

 function getInfo()
 {
     return confToHash(dirname(__FILE__) . '/README');
 }
开发者ID:nunoflores,项目名称:driver,代码行数:4,代码来源:renderer.php

示例14: list

 /**
  * Loads the given plugin and creates an object of it
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  *
  * @param  $type     string type of plugin to load
  * @param  $name     string name of the plugin to load
  * @param  $new      bool   true to return a new instance of the plugin, false to use an already loaded instance
  * @param  $disabled bool   true to load even disabled plugins
  * @return objectreference  the plugin object or null on failure
  */
 function &load($type, $name, $new = false, $disabled = false)
 {
     //we keep all loaded plugins available in global scope for reuse
     global $DOKU_PLUGINS;
     list($plugin, $component) = $this->_splitName($name);
     // check if disabled
     if (!$disabled && $this->isdisabled($plugin)) {
         return null;
     }
     //plugin already loaded?
     if (!empty($DOKU_PLUGINS[$type][$name])) {
         if ($new || !$DOKU_PLUGINS[$type][$name]->isSingleton()) {
             $class = $type . '_plugin_' . $name;
             return class_exists($class) ? new $class() : null;
         } else {
             return $DOKU_PLUGINS[$type][$name];
         }
     }
     //try to load the wanted plugin file
     $dir = $this->get_directory($plugin);
     $file = $component ? "{$type}/{$component}.php" : "{$type}.php";
     if (!is_file(DOKU_PLUGIN . "{$dir}/{$file}")) {
         return null;
     }
     if (!(include_once DOKU_PLUGIN . "{$dir}/{$file}")) {
         return null;
     }
     //construct class and instantiate
     $class = $type . '_plugin_' . $name;
     if (!class_exists($class)) {
         # the plugin might be in the wrong directory
         $inf = confToHash(DOKU_PLUGIN . "{$dir}/plugin.info.txt");
         if ($inf['base'] && $inf['base'] != $plugin) {
             msg("Plugin installed incorrectly. Rename plugin directory '" . hsc($plugin) . "' to '" . hsc($inf['base']) . "'.", -1);
         }
         return null;
     }
     $DOKU_PLUGINS[$type][$name] = new $class();
     return $DOKU_PLUGINS[$type][$name];
 }
开发者ID:rezlemic,项目名称:dokuwiki-jQuery,代码行数:51,代码来源:plugincontroller.class.php

示例15: load

 /**
  * Loads the given plugin and creates an object of it
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  *
  * @param  $type     string type of plugin to load
  * @param  $name     string name of the plugin to load
  * @param  $new      bool   true to return a new instance of the plugin, false to use an already loaded instance
  * @param  $disabled bool   true to load even disabled plugins
  * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|null  the plugin object or null on failure
  */
 public function load($type, $name, $new = false, $disabled = false)
 {
     //we keep all loaded plugins available in global scope for reuse
     global $DOKU_PLUGINS;
     list($plugin, $component) = $this->_splitName($name);
     // check if disabled
     if (!$disabled && $this->isdisabled($plugin)) {
         return null;
     }
     $class = $type . '_plugin_' . $name;
     //plugin already loaded?
     if (!empty($DOKU_PLUGINS[$type][$name])) {
         if ($new || !$DOKU_PLUGINS[$type][$name]->isSingleton()) {
             return class_exists($class, true) ? new $class() : null;
         } else {
             return $DOKU_PLUGINS[$type][$name];
         }
     }
     //construct class and instantiate
     if (!class_exists($class, true)) {
         # the plugin might be in the wrong directory
         $dir = $this->get_directory($plugin);
         $inf = confToHash(DOKU_PLUGIN . "{$dir}/plugin.info.txt");
         if ($inf['base'] && $inf['base'] != $plugin) {
             msg(sprintf("Plugin installed incorrectly. Rename plugin directory '%s' to '%s'.", hsc($plugin), hsc($inf['base'])), -1);
         } elseif (preg_match('/^' . DOKU_PLUGIN_NAME_REGEX . '$/', $plugin) !== 1) {
             msg(sprintf("Plugin name '%s' is not a valid plugin name, only the characters a-z and 0-9 are allowed. " . 'Maybe the plugin has been installed in the wrong directory?', hsc($plugin)), -1);
         }
         return null;
     }
     $DOKU_PLUGINS[$type][$name] = new $class();
     return $DOKU_PLUGINS[$type][$name];
 }
开发者ID:jotttt,项目名称:ttu-wiki,代码行数:44,代码来源:plugincontroller.class.php


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