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


PHP String::webalize方法代码示例

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


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

示例1: createComponentAddTagForm

 protected function createComponentAddTagForm()
 {
     $form = new AppForm();
     $form->addText("name", "Name", 40, 50);
     $form->addSubmit("s", "Add");
     $presenter = $this;
     $form->onSubmit[] = function ($form) use($presenter) {
         $name = $form->values["name"];
         $tag = new Tag();
         $tag->name = $name;
         $tag->url = String::webalize($name);
         try {
             $tag->save();
             $presenter->flashMessage("Tag was added!");
             $presenter->redirect("default");
         } catch (\ModelException $e) {
             $tag->addErrorsToForm($form);
         }
     };
     return $form;
 }
开发者ID:janmarek,项目名称:Ormion,代码行数:21,代码来源:TagPresenter.php

示例2: setUrl

	public function setUrl($url)
	{
		$this->url = String::webalize($url);
	}
开发者ID:JanTvrdik,项目名称:Neuron,代码行数:4,代码来源:Page.php

示例3: json_encode

// security check
//if (!$allowed) {
//	$state["error"] = "You are not allowed to upload files.";
//}
if (empty($file)) {
    $state["error"] = "No file was uploaded";
}
// check directory
if ($root === false || $dir === false || !String::startsWith($dir, $root) || !is_dir($dir) || !is_writable($dir)) {
    $state["error"] = "Problem with directory to upload.";
}
if (!empty($state["error"])) {
    die(json_encode($state));
}
if ($file->isOk()) {
    $filename = String::webalize($file->getName(), ".");
    $success = @$file->move("{$dir}/{$filename}");
    if ($success) {
        // nastavit typ - je to obrázek?
        $type = @$file->getImageSize() ? "image" : "file";
        $prefix = $type == "image" ? FILES_IMAGE_INCLUDE_PREFIX : FILES_FILE_INCLUDE_PREFIX;
        $state["filename"] = $prefix . ($folder ? "{$folder}/" : "") . $filename;
        $state["type"] = $type;
    } else {
        $state["error"] = "Move failed";
    }
} else {
    $state["error"] = "Upload error " . $file->getError();
}
// výstup
echo json_encode($state);
开发者ID:darkmoon32,项目名称:Texyla,代码行数:31,代码来源:upload.php

示例4: setName

 public function setName($name)
 {
     $this->name = $name;
     $this->url = \Nette\String::webalize($name);
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:5,代码来源:Tag.php

示例5: actionRename

 /**
  * Rename file or directory
  * @param string folder
  * @param string old item name
  * @param string new item name
  */
 public function actionRename($folder, $oldname, $newname)
 {
     // check rights
     if (!$this->getUser()->isInRole("admin")) {
         $this->sendError("Access denied.");
     }
     $oldpath = $this->getFolderPath($folder) . "/" . $oldname;
     $newpath = $this->getFolderPath($folder) . "/" . String::webalize($newname, ".");
     if (!file_exists($oldpath)) {
         $this->sendError("File does not exist.");
     }
     if (rename($oldpath, $newpath)) {
         $this->sendResponse(new JsonResponse(array("deleted" => true)));
     } else {
         $this->sendError("Unable to rename file.");
     }
 }
开发者ID:janmarek,项目名称:Neuron,代码行数:23,代码来源:TexylaPresenter.php


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