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


PHP gp_url_join函数代码示例

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


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

示例1: test_gp_url_with_arrays

 function test_gp_url_with_arrays()
 {
     $this->assertEquals('baba', gp_url_join(array('baba')));
     $this->assertEquals('baba/dyado', gp_url_join(array('baba', 'dyado')));
     // test some shortcuts -- arrays instead of gp_url_join calls
     $this->assertEquals(gp_url_join(gp_url_project('/x'), 'import-originals'), gp_url_project('/x', 'import-originals'));
     $this->assertEquals(gp_url_project('/x', gp_url_join('slug', 'slugslug', 'import-translations')), gp_url_project('/x', array('slug', 'slugslug', 'import-translations')));
 }
开发者ID:rmccue,项目名称:GlotPress,代码行数:8,代码来源:test_urls.php

示例2: gp_url

/**
 * Builds a URL relative to the GlotPress base
 * 
 * @param mixed $path string path or array of path components
 * @param array $query associative array of query arguments (optional)
 */
function gp_url($path, $query = null)
{
    $url = gp_url_join(gp_url_path(gp_get_option('url')), $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    return apply_filters('gp_url', $url, $path, $query);
}
开发者ID:rmccue,项目名称:GlotPress,代码行数:16,代码来源:url.php

示例3: gp_url_add_path_and_query

function gp_url_add_path_and_query($base, $path, $query)
{
    // todo: same domain with current url?
    $url = gp_url_join($base, $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    return apply_filters('gp_url_add_path_and_query', $url, $base, $path, $query);
}
开发者ID:johnjamesjacoby,项目名称:GlotPress-WP,代码行数:11,代码来源:url.php

示例4: edit_get

 function edit_get($set_id)
 {
     $items = $this->get_set_project_and_locale_from_set_id_or_404($set_id);
     if (!$items) {
         return;
     }
     list($set, $project, $locale) = $items;
     if ($this->cannot_and_redirect('write', 'project', $set->project_id, gp_url_project($project))) {
         return;
     }
     $url = gp_url_project($project, gp_url_join($set->locale, $set->slug));
     $this->tmpl('translation-set-edit', get_defined_vars());
 }
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:13,代码来源:translation-set.php

示例5: edit_post

 function edit_post($glossary_id)
 {
     $glossary = GP::$glossary->get($glossary_id);
     $new_glossary = new GP_Glossary(gp_post('glossary'));
     if ($this->cannot_edit_glossary_and_redirect($glossary)) {
         return;
     }
     if (!$glossary->update($new_glossary)) {
         $this->errors[] = __('Error in updating glossary!');
         $this->redirect();
         return;
     }
     $this->notices[] = __('The glossary was updated!');
     $translation_set = $new_glossary->translation_set_id ? GP::$translation_set->get($new_glossary->translation_set_id) : null;
     $set_project = GP::$project->get($translation_set->project_id);
     $this->redirect(gp_url_join(gp_url_project($set_project, array($translation_set->locale, $translation_set->slug)), array('glossary')));
 }
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:17,代码来源:glossary.php

示例6: gp_url_add_path_and_query

function gp_url_add_path_and_query($base, $path, $query)
{
    // todo: same domain with current url?
    $url = gp_url_join($base, $path);
    if ($query && is_array($query)) {
        $url = add_query_arg(urlencode_deep($query), $url);
    } elseif ($query) {
        $url .= '?' . ltrim($query, '?');
    }
    /**
     * Filter a GlotPress URL with path and query.
     *
     * @since 1.0.0
     *
     * @param string $url Generated URL.
     * @param string $base The base path.
     * @param array  $path The GlotPress path or the components as an array.
     * @param string $query The query part of the URL.
     */
    return apply_filters('gp_url_add_path_and_query', $url, $base, $path, $query);
}
开发者ID:chantalcoolsma,项目名称:GlotPress-WP,代码行数:21,代码来源:url.php

示例7: translations_get

 function translations_get($project_path, $locale_slug, $translation_set_slug)
 {
     $project = GP::$project->by_path($project_path);
     $locale = GP_Locales::by_slug($locale_slug);
     $translation_set = GP::$translation_set->by_project_id_slug_and_locale($project->id, $translation_set_slug, $locale_slug);
     if (!$project || !$locale || !$translation_set) {
         gp_tmpl_404();
     }
     $page = gp_get('page', 1);
     $filters = gp_get('filters', array());
     $sort = gp_get('sort', array());
     if ('random' == gp_array_get($sort, 'by')) {
         add_filter('gp_pagination', create_function('$html', 'return "";'));
     }
     $translations = GP::$translation->for_translation($project, $translation_set, $page, $filters, $sort);
     $total_translations_count = GP::$translation->found_rows;
     $per_page = GP::$translation->per_page;
     $can_edit = GP::$user->logged_in();
     $can_approve = $this->can('approve', 'translation-set', $translation_set->id);
     $url = gp_url_project($project, gp_url_join($locale->slug, $translation_set->slug));
     $discard_warning_url = gp_url_project($project, gp_url_join($locale->slug, $translation_set->slug, '_discard-warning'));
     $approve_action = gp_url_join($url, '_approve');
     gp_tmpl_load('translations', get_defined_vars());
 }
开发者ID:rmccue,项目名称:GlotPress,代码行数:24,代码来源:translation.php

示例8: gp_link_glossary_edit_get

function gp_link_glossary_edit_get($glossary, $set, $text = false, $attrs = array())
{
    if (!GP::$user->current()->can('approve', 'translation_set', $set->id)) {
        return '';
    }
    $text = $text ? $text : __('Edit');
    return gp_link_get(gp_url(gp_url_join('/glossaries', $glossary->id, '-edit')), $text, gp_attrs_add_class($attrs, 'action edit'));
}
开发者ID:rmccue,项目名称:glotpress-plugin,代码行数:8,代码来源:template-links.php

示例9: regenerate_paths

 /**
  * Regenrate the paths of all projects from its parents slugs
  */
 function regenerate_paths($parent_project_id = null)
 {
     // TODO: do it with one query. Use the tree generation code from GP_Route_Main::_options_from_projects()
     if ($parent_project_id) {
         $parent_project = $this->get($parent_project_id);
         $path = $parent_project->path;
     } else {
         $path = '';
         $parent_project_id = null;
     }
     $projects = $this->find(array('parent_project_id' => $parent_project_id));
     foreach ((array) $projects as $project) {
         $project->update(array('path' => gp_url_join($path, $project->slug)));
         $this->regenerate_paths($project->id);
     }
 }
开发者ID:rmccue,项目名称:GlotPress,代码行数:19,代码来源:project.php

示例10: foreach

		<tbody>
		<?php 
foreach ($locales as $locale) {
    ?>
			<tr class="<?php 
    echo $parity();
    ?>
">
				<?php 
    echo "<td>" . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->english_name) . "</td>";
    ?>
				<?php 
    echo "<td>" . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->native_name) . "</td>";
    ?>
				<?php 
    echo "<td>" . gp_link_get(gp_url_join(gp_url_current(), $locale->slug), $locale->slug) . "</td>";
    ?>
			</tr>
		<?php 
}
?>
		</tbody>
	</table>

	<script type="text/javascript" charset="utf-8">
		jQuery(document).ready(function($) {
			$('.locales').tablesorter({
				headers: {
					0: {
						sorter: 'text'
					}
开发者ID:Tucev,项目名称:Glot-O-Matic,代码行数:31,代码来源:locales.php

示例11: test_gp_url_project_should_join_its_array_arguments

 function test_gp_url_project_should_join_its_array_arguments()
 {
     $url_from_gp_url_project = gp_url_project('/x', array('slug', 'slugslug', 'import-translations'));
     $url_manually_joined = gp_url_join(gp_url_project('/x'), 'slug', 'slugslug', 'import-translations');
     $this->assertEquals($url_manually_joined, $url_from_gp_url_project);
 }
开发者ID:chantalcoolsma,项目名称:GlotPress-WP,代码行数:6,代码来源:test_urls.php

示例12: gp_link

            ?>
						</td>
						<td class="stats translated"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[translated]' => 'yes', 'filters[status]' => 'current')), absint($set_data->current_count));
            ?>
</td>
						<td class="stats fuzzy"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[status]' => 'fuzzy')), absint($set_data->fuzzy_count));
            ?>
</td>
						<td class="stats untranslated"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[status]' => 'untranslated')), absint($set_data->all_count) - absint($set_data->current_count));
            ?>
</td>
						<td class="stats waiting"><?php 
            gp_link(gp_url_project($set_data->project_path, gp_url_join($locale->slug, $set_data->slug), array('filters[translated]' => 'yes', 'filters[status]' => 'waiting')), absint($set_data->waiting_count));
            ?>
</td>
						</tr>
					<?php 
        }
        //sub project slugs
        ?>
					</tr>
				<?php 
    }
    //sub projects
    ?>
				</tbody>
			</table>
		</div>
开发者ID:WeFoster,项目名称:translate.wefoster.co,代码行数:31,代码来源:locale.php

示例13: esc_html

        ?>
</td>
					<td><?php 
        echo esc_html($permission->action);
        ?>
</td>
					<td><?php 
        echo esc_html($permission->locale_slug);
        ?>
</td>
					<td><?php 
        echo esc_html($permission->set_slug);
        ?>
</td>
					<td><a href="<?php 
        echo esc_url(gp_route_nonce_url(gp_url_join(gp_url_current(), '-delete/' . $permission->id), 'delete-project-permission_' . $permission->id));
        ?>
" class="action delete"><?php 
        _e('Delete', 'glotpress');
        ?>
</a></td>
				</tr>
			<?php 
    }
    ?>
		</tbody>
	</table>
	<?php 
}
?>
	<?php 
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:31,代码来源:project-permissions.php

示例14: esc_html

        ?>
</span>
			<span class="user"><?php 
        echo esc_html($permission->locale_slug);
        ?>
</span>
			<span class="permission-action"><?php 
        _e('and slug');
        ?>
</span>
			<span class="user"><?php 
        echo esc_html($permission->set_slug);
        ?>
</span>
			<a href="<?php 
        echo gp_url_join(gp_url_current(), '-delete/' . $permission->id);
        ?>
" class="action delete"><?php 
        _e('Remove');
        ?>
</a>
		</li>
	<?php 
    }
    ?>
</ul>
	<?php 
}
?>
	<?php 
if ($parent_permissions) {
开发者ID:pedro-mendonca,项目名称:GlotPress-WP,代码行数:31,代码来源:project-permissions.php

示例15: gp_link_glossary_delete_get

/**
 * Creates a HTML link to the delete page for translations sets.
 *
 * Does the heavy lifting for gp_link_glossary_delete.
 *
 * @since 2.0.0
 *
 * @param GP_Glossary        $glossary The glossary to link to.
 * @param GP_Translation_Set $set      The translation set the glossary is for.
 * @param string             $text     The text to use for the link.
 * @param array              $attrs    Additional attributes to use to determine the classes for the link.
 * @return string The HTML link.
 */
function gp_link_glossary_delete_get($glossary, $set, $text = false, $attrs = array())
{
    if (!GP::$permission->current_user_can('delete', 'translation-set', $set->id)) {
        return '';
    }
    $text = $text ? $text : __('Delete', 'glotpress');
    return gp_link_get(gp_url(gp_url_join('/glossaries', $glossary->id, '-delete')), $text, gp_attrs_add_class($attrs, 'action edit'));
}
开发者ID:ramiy,项目名称:GlotPress-WP,代码行数:21,代码来源:template-links.php


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