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


PHP SucomUtil::rename_keys方法代码示例

本文整理汇总了PHP中SucomUtil::rename_keys方法的典型用法代码示例。如果您正苦于以下问题:PHP SucomUtil::rename_keys方法的具体用法?PHP SucomUtil::rename_keys怎么用?PHP SucomUtil::rename_keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SucomUtil的用法示例。


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

示例1: options

 public function options($options_name, &$opts = array(), $def_opts = array())
 {
     $opts = SucomUtil::rename_keys($opts, $this->renamed_keys);
     // custom value changes for regular options
     if ($options_name == constant($this->p->cf['uca'] . '_OPTIONS_NAME')) {
         if ($opts['options_version'] <= 270) {
             foreach ($opts as $key => $val) {
                 if (strpos($key, 'inc_') === 0) {
                     $new_key = '';
                     switch ($key) {
                         case preg_match('/^inc_(description|twitter:)/', $key) ? true : false:
                             $new_key = preg_replace('/^inc_/', 'add_meta_name_', $key);
                             break;
                         default:
                             $new_key = preg_replace('/^inc_/', 'add_meta_property_', $key);
                             break;
                     }
                     if (!empty($new_key)) {
                         $opts[$new_key] = $val;
                     }
                     unset($opts[$key]);
                 }
             }
         }
         if ($opts['options_version'] <= 260) {
             if ($opts['og_img_width'] == 1200 && $opts['og_img_height'] == 630 && !empty($opts['og_img_crop'])) {
                 $this->p->notice->inf('Open Graph Image Dimentions have been updated from ' . $opts['og_img_width'] . 'x' . $opts['og_img_height'] . ', ' . ($opts['og_img_crop'] ? '' : 'un') . 'cropped to ' . $def_opts['og_img_width'] . 'x' . $def_opts['og_img_height'] . ', ' . ($def_opts['og_img_crop'] ? '' : 'un') . 'cropped.', true);
                 $opts['og_img_width'] = $def_opts['og_img_width'];
                 $opts['og_img_height'] = $def_opts['og_img_height'];
                 $opts['og_img_crop'] = $def_opts['og_img_crop'];
             }
         }
         if ($opts['options_version'] <= 247) {
             if (!empty($opts['twitter_shorten'])) {
                 $opts['twitter_shortener'] = 'googl';
                 unset($opts['twitter_shorten']);
             }
         }
         if ($opts['options_version'] <= 28) {
             // upgrade the old og_img_size name into width / height / crop values
             if (array_key_exists('og_img_size', $opts)) {
                 if (!empty($opts['og_img_size']) && $opts['og_img_size'] !== 'medium') {
                     $size_info = $this->p->media->get_size_info($opts['og_img_size']);
                     if ($size_info['width'] > 0 && $size_info['height'] > 0) {
                         $opts['og_img_width'] = $size_info['width'];
                         $opts['og_img_height'] = $size_info['height'];
                         $opts['og_img_crop'] = $size_info['crop'];
                     }
                 }
                 unset($opts['og_img_size']);
             }
         }
     }
     $opts = $this->sanitize($opts, $def_opts);
     // cleanup excess options and sanitize
     return $opts;
 }
开发者ID:kivivuori,项目名称:jotain,代码行数:57,代码来源:upgrade.php

示例2: options

 public function options($options_name, &$opts = array(), $def_opts = array())
 {
     // retrieve the first numeric string
     $opts_version = empty($opts['options_version']) ? 0 : preg_replace('/^[^0-9]*([0-9]*).*$/', '$1', $opts['options_version']);
     if ($options_name === constant('WPSSO_OPTIONS_NAME')) {
         $opts = SucomUtil::rename_keys($opts, $this->renamed_keys);
         if (version_compare($opts_version, 260, '<=')) {
             if ($opts['og_img_width'] == 1200 && $opts['og_img_height'] == 630 && !empty($opts['og_img_crop'])) {
                 $this->p->notice->inf('Open Graph Image Dimentions have been updated from ' . $opts['og_img_width'] . 'x' . $opts['og_img_height'] . ', ' . ($opts['og_img_crop'] ? '' : 'un') . 'cropped to ' . $def_opts['og_img_width'] . 'x' . $def_opts['og_img_height'] . ', ' . ($def_opts['og_img_crop'] ? '' : 'un') . 'cropped.', true);
                 $opts['og_img_width'] = $def_opts['og_img_width'];
                 $opts['og_img_height'] = $def_opts['og_img_height'];
                 $opts['og_img_crop'] = $def_opts['og_img_crop'];
             }
         }
         if (version_compare($opts_version, 270, '<=')) {
             foreach ($opts as $key => $val) {
                 if (strpos($key, 'inc_') === 0) {
                     $new_key = '';
                     switch ($key) {
                         case preg_match('/^inc_(description|twitter:)/', $key) ? true : false:
                             $new_key = preg_replace('/^inc_/', 'add_meta_name_', $key);
                             break;
                         default:
                             $new_key = preg_replace('/^inc_/', 'add_meta_property_', $key);
                             break;
                     }
                     if (!empty($new_key)) {
                         $opts[$new_key] = $val;
                     }
                     unset($opts[$key]);
                 }
             }
         }
         if (version_compare($opts_version, 296, '<=')) {
             if (empty($opts['plugin_min_shorten']) || $opts['plugin_min_shorten'] < 22) {
                 $opts['plugin_min_shorten'] = 22;
             }
         }
         if (version_compare($opts_version, 373, '<=')) {
             if (!empty($opts['plugin_head_attr_filter_name']) && $opts['plugin_head_attr_filter_name'] === 'language_attributes') {
                 $opts['plugin_head_attr_filter_name'] = 'head_attributes';
             }
         }
     } elseif ($options_name === constant('WPSSO_SITE_OPTIONS_NAME')) {
         $opts = SucomUtil::rename_keys($opts, $this->renamed_site_keys);
     }
     if (version_compare($opts_version, 342, '<=')) {
         if (isset($opts['plugin_file_cache_hrs'])) {
             $opts['plugin_file_cache_exp'] = $opts['plugin_file_cache_hrs'] * 3600;
             unset($opts['plugin_file_cache_hrs']);
         }
     }
     return $this->sanitize($opts, $def_opts);
     // cleanup options and sanitize
 }
开发者ID:sonvq,项目名称:passioninvestment,代码行数:55,代码来源:upgrade.php

示例3: options

 public function options($options_name, &$opts = array(), $def_opts = array())
 {
     $opts = SucomUtil::rename_keys($opts, $this->renamed_keys);
     // custom value changes for regular options
     if ($options_name == constant($this->p->cf['uca'] . '_OPTIONS_NAME')) {
         if (version_compare($opts['options_version'], 260, '<=')) {
             if ($opts['og_img_width'] == 1200 && $opts['og_img_height'] == 630 && !empty($opts['og_img_crop'])) {
                 $this->p->notice->inf('Open Graph Image Dimentions have been updated from ' . $opts['og_img_width'] . 'x' . $opts['og_img_height'] . ', ' . ($opts['og_img_crop'] ? '' : 'un') . 'cropped to ' . $def_opts['og_img_width'] . 'x' . $def_opts['og_img_height'] . ', ' . ($def_opts['og_img_crop'] ? '' : 'un') . 'cropped.', true);
                 $opts['og_img_width'] = $def_opts['og_img_width'];
                 $opts['og_img_height'] = $def_opts['og_img_height'];
                 $opts['og_img_crop'] = $def_opts['og_img_crop'];
             }
         }
         if (version_compare($opts['options_version'], 270, '<=')) {
             foreach ($opts as $key => $val) {
                 if (strpos($key, 'inc_') === 0) {
                     $new_key = '';
                     switch ($key) {
                         case preg_match('/^inc_(description|twitter:)/', $key) ? true : false:
                             $new_key = preg_replace('/^inc_/', 'add_meta_name_', $key);
                             break;
                         default:
                             $new_key = preg_replace('/^inc_/', 'add_meta_property_', $key);
                             break;
                     }
                     if (!empty($new_key)) {
                         $opts[$new_key] = $val;
                     }
                     unset($opts[$key]);
                 }
             }
         }
         if (version_compare($opts['options_version'], 296, '<=')) {
             if ($opts['plugin_min_shorten'] < 22) {
                 $opts['plugin_min_shorten'] = 22;
             }
         }
     }
     $opts = $this->sanitize($opts, $def_opts);
     // cleanup excess options and sanitize
     return $opts;
 }
开发者ID:christocmp,项目名称:bingopaws,代码行数:42,代码来源:upgrade.php


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