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


PHP SucomUtil::is_assoc方法代码示例

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


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

示例1: get_html

 public function get_html($data = null, $title = null, $backtrace = 1)
 {
     if ($this->is_on('html') !== true) {
         return;
     }
     $from = '';
     $html = '<!-- ' . $this->display_name . ' debug';
     $stack = debug_backtrace();
     if (!empty($stack[$backtrace]['class'])) {
         $from .= $stack[$backtrace]['class'] . '::';
     }
     if (!empty($stack[$backtrace]['function'])) {
         $from .= $stack[$backtrace]['function'];
     }
     if ($data === null) {
         //$this->log( 'truncating debug log' );
         $data = $this->buffer;
         $this->buffer = array();
     }
     if (!empty($from)) {
         $html .= ' from ' . $from . '()';
     }
     if (!empty($title)) {
         $html .= ' ' . $title;
     }
     if (!empty($data)) {
         $html .= ' : ';
         if (is_array($data)) {
             $html .= "\n";
             $is_assoc = SucomUtil::is_assoc($data);
             if ($is_assoc) {
                 ksort($data);
             }
             foreach ($data as $key => $val) {
                 $html .= $is_assoc ? "\t{$key} = {$val}\n" : "\t{$val}\n";
             }
         } else {
             if (preg_match('/^Array/', $data)) {
                 $html .= "\n";
             }
             // check for print_r() output
             $html .= $data;
         }
     }
     $html .= ' -->' . "\n";
     return $html;
 }
开发者ID:kivivuori,项目名称:jotain,代码行数:47,代码来源:debug.php

示例2: get_tag_array

 /**
  * Loops through the arrays (1 to 3 dimensions) and calls get_single_tag() for each
  */
 private function get_tag_array($tag = 'meta', $type = 'property', $tag_array, $use_post = false)
 {
     if ($this->p->debug->enabled) {
         $this->p->debug->log(count($tag_array) . ' ' . $tag . ' ' . $type . ' to process');
         $this->p->debug->log($tag_array);
     }
     $ret = array();
     if (empty($tag_array)) {
         return $ret;
     } elseif (!is_array($tag_array)) {
         if ($this->p->debug->enabled) {
             $this->p->debug->log('exiting early: tag_array argument is not an array');
         }
         return $ret;
     }
     foreach ($tag_array as $f_name => $f_val) {
         // 1st-dimension array (associative)
         if (is_array($f_val)) {
             foreach ($f_val as $s_num => $s_val) {
                 // 2nd-dimension array
                 if (SucomUtil::is_assoc($s_val)) {
                     foreach ($s_val as $t_name => $t_val) {
                         // 3rd-dimension array (associative)
                         $ret = array_merge($ret, $this->get_single_tag($tag, $type, $t_name, $t_val, $f_name . ':' . ($s_num + 1), $use_post));
                     }
                 } else {
                     $ret = array_merge($ret, $this->get_single_tag($tag, $type, $f_name, $s_val, $f_name . ':' . ($s_num + 1), $use_post));
                 }
             }
         } else {
             $ret = array_merge($ret, $this->get_single_tag($tag, $type, $f_name, $f_val, '', $use_post));
         }
     }
     return $ret;
 }
开发者ID:jamesvillarrubia,项目名称:uniken-web,代码行数:38,代码来源:head.php

示例3: get_select

        public function get_select($name, $values = array(), $class = '', $id = '', $is_assoc = false, $disabled = false, $selected = false, $reload = false)
        {
            if (empty($name) || !is_array($values)) {
                return;
            }
            if ($is_assoc === false) {
                $is_assoc = SucomUtil::is_assoc($values);
            }
            $html = '';
            $select_id = empty($id) ? 'select_' . $name : 'select_' . $id;
            if ($reload === true) {
                $url = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
                $url .= $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
                $url = add_query_arg(array($name => '%%' . $name . '%%'), $url);
                $html .= '
<script type="text/javascript">
	jQuery(function(){
		jQuery("#' . $select_id . '").change(function(){
			url="' . $url . '"+jQuery(location).attr("hash");
			window.location=url.replace("%%' . $name . '%%", this.value);
		});
	});
</script>';
            }
            $html .= '<select name="' . $this->options_name . '[' . $name . ']"' . (empty($class) ? '' : ' class="' . $class . '"') . ' id="' . $select_id . '"' . ($disabled === true ? ' disabled="disabled"' : '') . '>' . "\n";
            foreach ($values as $val => $desc) {
                // if the array is NOT associative (so regular numered array),
                // then the description is used as the saved value as well
                if ($is_assoc == false) {
                    $val = $desc;
                }
                if ($val == -1) {
                    $desc = _x('(settings value)', 'option value', $this->text_dom);
                } else {
                    if ($this->text_dom) {
                        $desc = _x($desc, 'option value', $this->text_dom);
                    }
                    switch ($name) {
                        case 'og_img_max':
                            if ($desc === 0) {
                                $desc .= ' ' . _x('(no images)', 'option value', $this->text_dom);
                            }
                            break;
                        case 'og_vid_max':
                            if ($desc === 0) {
                                $desc .= ' ' . _x('(no videos)', 'option value', $this->text_dom);
                            }
                            break;
                        default:
                            if ($desc === '' || $desc === 'none') {
                                $desc = _x('[none]', 'option value', $this->text_dom);
                            }
                            break;
                    }
                    if ($this->in_defaults($name) && $val === $this->defaults[$name]) {
                        $desc .= ' ' . _x('(default)', 'option value', $this->text_dom);
                    }
                }
                $html .= '<option value="' . esc_attr($val) . '"';
                if ($selected !== false) {
                    $html .= selected($selected, $val, false);
                } elseif ($this->in_options($name)) {
                    $html .= selected($this->options[$name], $val, false);
                }
                $html .= '>' . $desc . '</option>' . "\n";
            }
            $html .= '</select>' . "\n";
            return $html;
        }
开发者ID:sonvq,项目名称:passioninvestment,代码行数:69,代码来源:form.php

示例4: get_tag_array

 /**
  * Loops through the arrays (1 to 3 dimensions) and calls get_single_tag() for each
  */
 private function get_tag_array($tag = 'meta', $type = 'property', $tag_array)
 {
     $this->p->debug->log(count($tag_array) . ' ' . $tag . ' ' . $type . ' to process');
     $this->p->debug->log($tag_array);
     $ret = array();
     if (empty($tag_array)) {
         return $ret;
     }
     foreach ($tag_array as $f_name => $f_val) {
         // 1st-dimension array (associative)
         if (is_array($f_val)) {
             foreach ($f_val as $s_num => $s_val) {
                 // 2nd-dimension array
                 if (SucomUtil::is_assoc($s_val)) {
                     ksort($s_val);
                     foreach ($s_val as $t_name => $t_val) {
                         // 3rd-dimension array (associative)
                         $ret = array_merge($ret, $this->get_single_tag($tag, $type, $t_name, $t_val, $f_name . ':' . ($s_num + 1)));
                     }
                 } else {
                     $ret = array_merge($ret, $this->get_single_tag($tag, $type, $f_name, $s_val, $f_name . ':' . ($s_num + 1)));
                 }
             }
         } else {
             $ret = array_merge($ret, $this->get_single_tag($tag, $type, $f_name, $f_val));
         }
     }
     return $ret;
 }
开发者ID:kanvasamsterdam,项目名称:deploykanvas,代码行数:32,代码来源:head.php

示例5: get_select

 public function get_select($name, $values = array(), $class = '', $id = '', $is_assoc = false, $disabled = false)
 {
     if (empty($name) || !is_array($values)) {
         return;
     }
     if ($is_assoc === false) {
         $is_assoc = SucomUtil::is_assoc($values);
     }
     $html = '<select name="' . $this->options_name . '[' . $name . ']"' . (empty($class) ? '' : ' class="' . $class . '"') . (empty($id) ? '' : ' id="' . $id . '"') . ($disabled === true ? ' disabled="disabled"' : '') . '>';
     foreach ($values as $val => $desc) {
         // if the array is NOT associative (so regular numered array),
         // then the description is used as the saved value as well
         if ($is_assoc == false) {
             $val = $desc;
         }
         if ($val == -1) {
             $desc = '(value from settings)';
         } else {
             switch ($name) {
                 case 'og_img_max':
                     if ($desc === 0) {
                         $desc .= ' (no images)';
                     }
                     break;
                 case 'og_vid_max':
                     if ($desc === 0) {
                         $desc .= ' (no videos)';
                     }
                     break;
                 default:
                     if ($desc === '' || $desc === 'none') {
                         $desc = '[none]';
                     }
                     break;
             }
             if ($this->in_defaults($name) && $val === $this->defaults[$name]) {
                 $desc .= ' (default)';
             }
         }
         $html .= '<option value="' . esc_attr($val) . '"';
         if ($this->in_options($name)) {
             $html .= selected($this->options[$name], $val, false);
         }
         $html .= '>' . $desc . '</option>';
     }
     $html .= '</select>';
     return $html;
 }
开发者ID:coollog,项目名称:theboola,代码行数:48,代码来源:form.php


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