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


PHP prettify_string函数代码示例

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


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

示例1: _add_field_lock_elements

 function _add_field_lock_elements(&$disco, &$entity)
 {
     $cm = $this->_load_content_manager();
     $locks = $entity->get_locks();
     $shown_fields = array();
     $hidden_fields = array();
     $values = array();
     foreach ($locks->get_lockable_fields() as $field) {
         $label = prettify_string($field);
         if ($cm->is_element($field)) {
             $el = $cm->get_element($field);
             if (!empty($el->display_name) && $el->display_name != ' ' && $el->display_name != ' ') {
                 $label = $el->display_name;
             }
         }
         if (!$cm->is_element($field) || $cm->element_is_hidden($field)) {
             $hidden_fields[$field] = '<span class="hiddenInContentManager">' . $label . '</span>';
         } else {
             $shown_fields[$field] = $label;
         }
         if ($entity->field_has_lock($field)) {
             $values[] = $field;
         }
     }
     $fields = $shown_fields + $hidden_fields;
     if (!empty($fields)) {
         $disco->add_element('lock_all_fields', 'checkbox');
         if ($entity->has_all_fields_lock()) {
             $disco->set_value('lock_all_fields', true);
         }
     }
     $disco->add_element('lock_specific_fields', 'checkboxgroup_no_sort', array('options' => $fields));
     $disco->set_value('lock_specific_fields', $values);
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:34,代码来源:manage_locks.php

示例2: thor_build_display_values

	function thor_build_display_values()
	{
		$form = new entity($this->form_id);
		$form->get_values();
		if ($form->get_value('type') != id_of('form'))
		{
			trigger_error('the thor viewer was passed an invalid id ('.$form_id.') - it must be passed the ID of a reason form entity');
		}
		else
		{
			$form_xml_obj = new XMLParser($form->get_value('thor_content'));
			$form_xml_obj->Parse();
			$display_values = array();
			foreach ($form_xml_obj->document->tagChildren as $k=>$v)
			{
				$tagname = is_object($v) ? $v->tagName : '';
				if (method_exists($this, '_build_display_'.$tagname))
				{
					$build_function = '_build_display_'.$tagname;
					$display_values = array_merge($display_values, $this->$build_function($v));
				}
			}
		}
		foreach ($this->extra_fields as $field_name)
		{
			$display_values[$field_name]['label'] = prettify_string($field_name);
			$display_values[$field_name]['type'] = 'text';
		}
		$this->_display_values = (isset($display_values)) ? $display_values : array();
	}
开发者ID:natepixel,项目名称:reason_package,代码行数:30,代码来源:thor_viewer.php

示例3: grab_fields

 /**
  * Grabs Any Search fields from the Viewer and sets up display names properly
  * @param Viewer $viewer The viewer that we are a part of
  * @return void
  */
 function grab_fields($viewer)
 {
     $this->set_form_method('get');
     if (!$this->has_filters()) {
         unset($this->actions['clear']);
     }
     // remove filter if we have no search fields
     $this->add_element('search_exact_id', 'hidden');
     $this->set_value('search_exact_id', true);
     $this->add_element('refresh_lister_state', 'hidden');
     $this->set_value('refresh_lister_state', true);
     if ($viewer) {
         $this->get_db_fields($viewer);
         reset($viewer);
         while (list($field, ) = each($viewer)) {
             $key = 'search_' . $field;
             //add fields in different ways
             if (!empty($this->fields[$field]) && preg_match("/^enum\\((.*)\\)\$/", $this->fields[$field]['db_type'])) {
                 $this->add_enum_element($field);
             } else {
                 $this->add_element($key, 'text', array('size' => 20));
             }
             if (isset($this->page->request[$key]) and $this->page->request[$key]) {
                 $this->set_value($key, $this->page->request[$key]);
             }
             $this->set_display_name($key, prettify_string($field));
         }
     }
     foreach ($this->page->module->viewer->request as $key => $value) {
         if (!$this->is_element($key)) {
             $this->add_element($key, 'hidden');
             $this->set_value($key, $value);
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:40,代码来源:filter.php

示例4: _build_filter_set

 /**
  * Assemble the markup for a particular filter selector
  * @return string
  * @access private
  */
 function _build_filter_set($key)
 {
     $ret = '';
     $other_filter_links = $this->default_links;
     unset($other_filter_links[$key]);
     $combined_other_filter_links = implode('&amp;', $other_filter_links);
     $ret .= '<div class="filters">';
     foreach ($this->filter_types as $filter_name => $filter_type) {
         if (!empty($this->filter_entities[$filter_name])) {
             if ($type_id = id_of($filter_type['type'])) {
                 $type = new entity($type_id);
                 $name = $type->get_value('plural_name');
             } else {
                 $name = prettify_string($filter_name);
             }
             $ret .= '<h4>' . $name . '</h4>' . "\n";
             $ret .= '<ul>';
             if (!empty($this->filters[$key])) {
                 $link = '?';
                 if (!empty($this->search_value)) {
                     $link .= 'search=' . urlencode($this->search_value) . '&amp;';
                 }
                 if (!empty($other_filter_links)) {
                     $link .= $combined_other_filter_links;
                 }
                 $ret .= '<li><a href="' . $link . '">All</a></li>' . "\n";
             }
             foreach ($this->filter_entities[$filter_name] as $entity) {
                 $ret .= '<li>';
                 if (!empty($this->filters[$key]) && $this->filters[$key]['type'] == $filter_name && $this->filters[$key]['id'] == $entity->id()) {
                     $ret .= '<strong>' . $entity->get_value('name') . '</strong>' . "\n";
                 } else {
                     $link = '?';
                     if (!empty($other_filter_links)) {
                         $link .= $combined_other_filter_links . '&amp;';
                     }
                     if (!empty($this->search_value)) {
                         $link .= 'search=' . urlencode($this->search_value) . '&amp;';
                     }
                     $link .= 'filter' . $key . '=' . $filter_name . '-' . $entity->id();
                     if (!empty($this->textonly)) {
                         $link .= '&amp;textonly=1';
                     }
                     $ret .= '<a href="' . $link . '">' . $entity->get_value('name') . '</a>' . "\n";
                 }
                 $ret .= '</li>';
             }
             $ret .= '</ul>';
         }
     }
     $ret .= '</div>' . "\n";
     return $ret;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:58,代码来源:listnav.php

示例5: show_item_thor_content

 function show_item_thor_content($field, $value)
 {
     echo '<tr>';
     $this->_row = $this->_row % 2;
     $this->_row++;
     echo '<td class="listRow' . $this->_row . ' col1" >' . prettify_string($field);
     if ($field != '&nbsp;') {
         echo ':';
     }
     echo '</td>';
     $value = htmlspecialchars($value);
     echo '<td class="listRow' . $this->_row . ' col2">' . (($value or strlen($value) > 0) ? $value : '<em>(No value)</em>') . '</td>';
     echo '</tr>';
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:14,代码来源:form.php

示例6: run_error_checks

 function run_error_checks()
 {
     $name = trim($this->display_name);
     if (empty($name)) {
         $name = $this->name;
     }
     $name = prettify_string($name);
     $username = reason_require_authentication();
     $password = $this->grab_value();
     $dir = new directory_service();
     if (!$dir->authenticate($username, $password)) {
         $this->set_error($name . ':  Please check your password.');
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:14,代码来源:password_verification.php

示例7: run

    function run()
    {
        $type = new entity($this->admin_page->type_id);
        $entity = new entity($this->admin_page->id);
        $user = new entity($this->admin_page->user_id);
        $text = array('root_node' => 'This is a root ' . $type->get_value('name') . ', so you may not delete it.  If you wish to delete this item, please contact the <a href="' . $this->admin_page->make_link(array("cur_module" => "about_reason")) . '">web team</a>.', 'default' => 'You cannot currently delete this item because following items, which 
										are associated with it, must be associated with a ' . $type->get_value('name') . '. If 
										you wish to delete this item, you must first select a different ' . $type->get_value('name') . ' for each of the following items.<br /><br />', id_of('minisite_page') => 'This page has children.  In order to delete it, you must first either:
										<ul>
										<li>delete its children</li>
										<li>Select a different parent page for its children</li>
										</ul>If you wish to delete this item, please select a different parent for the pages listed below.<br /><br />', 'borrowed' => '<p>This item is currently borrowed by one or more sites.  Deleting it might break their sites.  If you still want to delete it, contact the sites\' maintainers to ask if they can stop borrowing the item.</p>', 'locks' => 'This ' . $type->get_value('name') . ' has had a lock applied to it that keeps it from being deleted. A reason administrator may have applied this lock in order to ensure that a site was not inadventently broken. Please contact a Reason administrator if you have any questions about the rationale for placing this lock on this ' . $type->get_value('name') . '.');
        if (!empty($this->borrowed_by)) {
            echo $text['borrowed'];
            echo '<h4>Sites borrowing this item</h4>' . "\n";
            echo '<ul>' . "\n";
            foreach ($this->borrowed_by as $site) {
                echo '<li><a href="' . $site->get_value('base_url') . '">' . $site->get_value('name') . '</a>' . "\n";
                echo '<div>Primary maintainer: ' . $site->get_value('name_cache') . ', <a href="mailto:' . $site->get_value('email_cache') . '" title="send email">' . $site->get_value('email_cache') . '</a></div></li>' . "\n";
            }
            echo '</ul>' . "\n";
        } elseif ($this->is_root_node()) {
            echo $text['root_node'];
        } elseif (!$entity->user_can_edit_field('state', $user)) {
            echo $text['locks'];
        } else {
            if (!empty($text[$this->admin_page->type_id])) {
                echo $text[$this->admin_page->type_id];
            } else {
                echo $text['default'];
            }
            foreach ($this->values as $v) {
                $link = $this->admin_page->make_link(array('cur_module' => 'Preview', 'id' => $v['e_id'], 'type_id' => $v['relationship_a']));
                echo '<a href="' . $link . '" target="' . $v['e_id'] . '">' . $v['e_name'] . '</a><span class="smallText"> (' . prettify_string($v['name']) . ')</span><br />';
            }
        }
    }
开发者ID:hunter2814,项目名称:reason_package,代码行数:37,代码来源:no_delete.php

示例8: load_options

 function load_options($args = array())
 {
     $files = array();
     if (isset($this->directory)) {
         if ($handle = opendir($this->directory)) {
             while ($entry = readdir($handle)) {
                 if (is_file($this->directory . $entry) && (!$this->hide_files_with_initial_period || 0 !== strpos($entry, '.'))) {
                     $show_entry = true;
                     $entry_display = $entry_value = $entry;
                     if (!empty($this->strip_extension)) {
                         $entry_display = $entry_value = substr($entry, 0, strrpos($entry, '.'));
                     }
                     if (!empty($this->prettify_file_name)) {
                         $entry_display = prettify_string(substr($entry, 0, strrpos($entry, '.')));
                     }
                     if (!empty($this->extension)) {
                         if (!preg_match('/' . $this->extension . '$/', $entry)) {
                             $show_entry = false;
                         }
                     }
                     if ($show_entry) {
                         $files[$entry_value] = $entry_display;
                     }
                 }
             }
             ksort($files);
         } else {
             trigger_error('Directory does not appear to be readable (' . $this->directory . ').');
         }
     }
     $this->options += $files;
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:32,代码来源:options.php

示例9: _show_embed_item

 /**
  * Displays an embed field.
  */
 private function _show_embed_item($field, $value)
 {
     echo '<tr id="' . str_replace(' ', '_', $field) . '_Row">';
     $this->previewer->_row = $this->previewer->_row % 2;
     $this->previewer->_row++;
     echo '<td class="listRow' . $this->previewer->_row . ' col1">';
     if ($lock_str = $this->previewer->_get_lock_indication_string($field)) {
         echo $lock_str . '&nbsp;';
     }
     echo prettify_string($field);
     if ($field != '&nbsp;') {
         echo ':';
     }
     echo '</td>';
     echo '<td class="listRow' . $this->previewer->_row . ' col2"><input id="' . $field . 'Element" type="text" readonly="readonly" size="50" value="' . htmlspecialchars($value) . '"></td>';
     echo '</tr>';
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:20,代码来源:media_work_previewer_modifier.php

示例10: get_display_name

 /**
  * Get the display name for a given element or element group
  * @param string $element_name
  * @param boolean $empty_ok
  * @return string
  */
 public function get_display_name($element_name, $empty_ok = true)
 {
     $display_name = prettify_string($element_name);
     //find the real display name, if one exists.
     if ($this->_is_element($element_name)) {
         $element_object = $this->get_element($element_name);
         $element_display_name = trim($element_object->display_name);
         if ($empty_ok || !empty($element_display_name)) {
             $display_name = prettify_string($element_display_name);
         }
     } elseif ($this->_is_element_group($element_name)) {
         $element_group_object = $this->get_element_group($element_name);
         $group_display_name = trim($element_group_object->display_name);
         if ($empty_ok || !empty($group_display_name)) {
             $display_name = prettify_string($group_display_name);
         }
     }
     return $display_name;
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:25,代码来源:disco.php

示例11: strtolower

     $chr1 = strtolower($page_type_name[0]);
     echo '<h2><a name = "' . $chr1 . '">' . strtoupper($chr1) . '</a></h2>';
 }
 echo '<h3><a name="' . $page_type_name . '">' . prettify_string($page_type_name) . '</a></h3>';
 echo '<ul>';
 foreach ($page_type->get_region_names() as $region) {
     $region_info = $page_type->get_region($region);
     $default_region_info = $default_pt->get_region($region);
     // (If the page is not default, then (if a region def differs from the default, then show it))
     // If the page is default, show all region defs.
     if ($page_type_name != 'default' && ($region_info['module_name'] != $default_region_info['module_name'] || $region_info['module_params'] != $default_region_info['module_params']) || $page_type_name == 'default') {
         $xtra = '';
         if (isset($GLOBALS['_reason_deprecated_modules']) && @in_array($region_info['module_name'], $GLOBALS['_reason_deprecated_modules'])) {
             $xtra = ' (deprecated)';
         }
         echo '<li>' . prettify_string($region) . ': ' . (!empty($region_info['module_name']) ? str_replace('_', ' ', "<strong>" . $region_info['module_name']) . "</strong>" . $xtra . "</li>" : "[empty]</li>");
     }
     if (!empty($region_info['module_params'])) {
         echo "Parameters: <ul>";
         foreach ($region_info['module_params'] as $param => $value) {
             if (!empty($value)) {
                 echo "<li>" . $param . ": ";
                 if (is_array($value)) {
                     pray($value);
                 } else {
                     echo $value;
                 }
                 echo "</li>";
             }
         }
         echo "</ul>";
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:view_page_type_info.php

示例12: grab

 function grab()
 {
     parent::grab();
     $length = strlen($this->value);
     $length_limits = array('tinytext' => 255, 'text' => 65535, 'mediumtext' => 16777215);
     if (!empty($this->db_type) && array_key_exists($this->db_type, $length_limits)) {
         if ($length > $length_limits[$this->db_type]) {
             $name_to_display = trim($this->display_name);
             if (empty($name_to_display)) {
                 $name_to_display = prettify_string($this->name);
             }
             $this->set_error('There is more text in ' . $name_to_display . ' than can be stored; this field can hold no more than ' . $length_limits[$this->db_type] . ' characters.');
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:15,代码来源:text.php

示例13: mysql_free_result

    mysql_free_result($r);
    echo $info['name'] . ': ' . $row[$info['var']] . '<br /><br />';
}
$multiple_result_queries = array(array('q' => 'SELECT user.name AS username, COUNT(*) AS number_of_entities_last_edited FROM entity AS user, entity AS e WHERE e.last_edited_by = user.id AND e.state = "Live" GROUP BY e.last_edited_by ORDER BY number_of_entities_last_edited DESC LIMIT ' . $num, 'name' => 'Active Users (Top ' . $num . ')'), array('q' => 'SELECT type.name AS type, COUNT(e.name) AS number_of_entities FROM entity AS type LEFT JOIN entity AS e ON e.type = type.id WHERE type.type = 1 AND e.state = "Live" GROUP BY type.id ORDER BY number_of_entities DESC LIMIT ' . $num, 'name' => 'Number of Entities by Type (Top ' . $num . ')'), array('q' => 'SELECT type.name AS type, COUNT(e.name) AS number_of_entities FROM entity AS type LEFT JOIN entity AS e ON e.type = type.id WHERE type.type = 1 AND e.state = "Live" GROUP BY type.id ORDER BY number_of_entities ASC LIMIT ' . $num, 'name' => 'Number of Entities by Type (Bottom ' . $num . ')'), array('q' => 'SELECT e.id,e.name,type.name as type,user.name as last_edited_by,DATE_FORMAT(e.creation_date,"%M %e, %Y %r") as creation_date FROM entity as e, entity as type, entity as user WHERE e.type = type.id AND e.last_edited_by = user.id AND e.state = "Live" ORDER BY e.creation_date DESC LIMIT ' . $num, 'name' => 'Recently Created'), array('q' => 'SELECT e.id,e.name,type.name as type,user.name as last_edited_by,DATE_FORMAT(e.last_modified,"%M %e, %Y %r") as last_modified FROM entity as e, entity as type, entity as user WHERE e.type = type.id AND e.last_edited_by = user.id AND e.state = "Live" ORDER BY e.last_modified DESC LIMIT ' . $num, 'name' => 'Recently Edited'), array('q' => 'SELECT e.id,e.name,type.name as type,user.name as last_edited_by,DATE_FORMAT(e.last_modified,"%M %e, %Y %r") as last_modified FROM entity as e, entity as type, entity as user WHERE e.type = type.id AND e.last_edited_by = user.id AND e.state = "Live" ORDER BY e.last_modified ASC LIMIT ' . $num, 'name' => 'Not Recently Edited'), array('q' => 'SELECT ar.name, e1.name AS type_a, e2.name as type_b, count(*) AS number_of_relationships FROM allowable_relationship AS ar, relationship AS r, entity AS e1, entity AS e2 WHERE r.type = ar.id AND ar.relationship_a = e1.id AND ar.relationship_b = e2.id GROUP BY r.type ORDER BY number_of_relationships DESC LIMIT ' . $num, 'name' => 'Number of Relationships by Type (with ownership)'), array('q' => 'SELECT ar.name, e1.name AS type_a, e2.name as type_b, count(*) AS number_of_relationships FROM allowable_relationship AS ar, relationship AS r, entity AS e1, entity AS e2 WHERE r.type = ar.id AND ar.relationship_a = e1.id AND ar.relationship_b = e2.id AND ar.name != "owns" GROUP BY r.type ORDER BY number_of_relationships DESC LIMIT ' . $num, 'name' => 'Number of Relationships by Type (without ownership)'), array('q' => 'SELECT state, count(*) AS Count FROM entity GROUP BY state ORDER BY Count DESC', 'name' => 'Entities by State'));
reset($multiple_result_queries);
while (list(, $mrq) = each($multiple_result_queries)) {
    $first_row = true;
    echo '<strong>' . $mrq['name'] . '</strong><br /><br />';
    echo '<table border="1" cellpadding="5">';
    $r = db_query($mrq['q'], 'Unable to ' . $mrq['name']);
    while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
        if ($first_row) {
            echo '<tr>';
            reset($row);
            while (list($key, ) = each($row)) {
                echo '<th>' . prettify_string($key) . '</th>';
            }
            echo '</tr>';
            $first_row = false;
        }
        echo '<tr>';
        reset($row);
        while (list($key, $val) = each($row)) {
            echo '<td>' . $val . '</td>';
        }
        echo '</tr>';
    }
    echo '</table>';
    echo '<br />';
}
//	echo '<strong>Session Variables</strong>';
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:stats.php

示例14: prettify_array

 /**
  * Recursively prettify all values of an array using prettify_string
  * @author Matt Ryan
  * @date 2006-05-18
  * @param array $array
  * @return array $prettified_array
  */
 function prettify_array($array)
 {
     foreach ($array as $k => $v) {
         if (is_array($v)) {
             $array[$k] = prettify_array($v);
         } else {
             $array[$k] = prettify_string($v);
         }
     }
     return $array;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:18,代码来源:misc.php

示例15: set_name

 /**
  * Sets the unique identifier ( {@link name}) for an instance of this element type.
  * Note that {@link name} needs to be set using this method; it cannot be set using {@link set_class_var()} or {@link init()}.
  * @param string $name The name of this instance of this element type.
  */
 function set_name($name)
 {
     $this->name = $name;
     if (!$this->display_name) {
         $this->display_name = prettify_string($name);
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:12,代码来源:default.php


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