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


PHP fix函数代码示例

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


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

示例1: __construct

 /**
  * Function: __construct
  * See Also:
  *     <Model::grab>
  */
 public function __construct($extension_id, $options = array())
 {
     if (!isset($extension_id) and empty($options)) {
         return;
     }
     $options["left_join"][] = array("table" => "versions", "where" => "extension_id = extensions.id");
     $options["select"][] = "extensions.*";
     $options["select"][] = "MAX(versions.created_at) AS last_update";
     $options["group"][] = "id";
     $options["order"] = array("__last_update DESC", "extensions.id DESC");
     parent::grab($this, $extension_id, $options);
     if ($this->no_results) {
         return false;
     }
     $this->textID = $this->url;
     $this->filtered = !isset($options["filter"]) or $options["filter"];
     $trigger = Trigger::current();
     if ($this->filtered) {
         if (!$this->user->group->can("code_in_extensions")) {
             $this->name = fix($this->name);
         }
         $trigger->filter($this->name, array("markup_title", "markup_extension_title"), $this);
     }
     $trigger->filter($this, "extension");
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:30,代码来源:Extension.php

示例2: __construct

 /**
  * Function: __construct
  * See Also:
  *     <Model::grab>
  */
 public function __construct($version_id, $options = array())
 {
     if (!isset($version_id) and empty($options)) {
         return;
     }
     $options["left_join"][] = array("table" => "notes", "where" => "version_id = versions.id");
     $options["select"][] = "versions.*";
     $options["select"][] = "COUNT(notes.id) AS note_count";
     $options["select"][] = "MAX(notes.created_at) AS last_note";
     $options["group"][] = "id";
     parent::grab($this, $version_id, $options);
     if ($this->no_results) {
         return false;
     }
     $this->compatible = array_map(array("Version", "numberfy"), (array) YAML::load($this->compatible));
     $this->tags = !empty($this->tags) ? YAML::load($this->tags) : array();
     $this->linked_tags = self::link_tags($this->tags);
     $this->filtered = !isset($options["filter"]) or $options["filter"];
     $trigger = Trigger::current();
     if ($this->filtered) {
         $this->description_unfiltered = $this->description;
         if (!$this->extension->user->group->can("code_in_extensions")) {
             $this->description = fix($this->description);
         }
         $trigger->filter($this->description, array("markup_text", "markup_version_text"), $this);
     }
     $trigger->filter($this, "version");
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:33,代码来源:Version.php

示例3: __construct

 /**
  * Function: __construct
  * See Also:
  *     <Model::grab>
  */
 public function __construct($ticket_id, $options = array())
 {
     if (!isset($ticket_id) and empty($options)) {
         return;
     }
     $options["left_join"][] = array("table" => "revisions", "where" => "ticket_id = tickets.id");
     $options["select"][] = "tickets.*";
     $options["select"][] = "COUNT(revisions.id) AS revision_count";
     $options["select"][] = "MAX(revisions.created_at) AS last_revision";
     $options["select"][] = "MAX(revisions.updated_at) AS last_update";
     $options["group"][] = "id";
     parent::grab($this, $ticket_id, $options);
     if ($this->no_results) {
         return false;
     }
     $this->last_activity = max(array_map("strtotime", array($this->last_revision, $this->last_update, $this->created_at, $this->updated_at)));
     $this->done = in_array($this->state, array("resolved", "invalid", "declined"));
     $this->filtered = !isset($options["filter"]) or $options["filter"];
     $trigger = Trigger::current();
     if ($this->filtered) {
         if (!$this->user->group->can("code_in_revisions")) {
             $this->title = fix($this->title);
             $this->description = fix($this->description);
         }
         $trigger->filter($this->title, array("markup_title", "markup_ticket_title"), $this);
         $trigger->filter($this->description, array("markup_text", "markup_ticket_text"), $this);
     }
     $trigger->filter($this, "ticket");
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:34,代码来源:Ticket.php

示例4: __install

 static function __install()
 {
     $digest = MAIN_DIR . DIR . "digest.txt.php";
     $output = "<?php header(\"Status: 403\"); exit(\"Access denied.\"); ?>\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/digest; boundary=\"---correspondence---\"\r\n" . "\r\n---correspondence---\r\n";
     if (!file_exists($digest) and !@file_put_contents($digest, $output)) {
         error(__("Error"), _f("The digest file <em>%s</em> could not be created.", fix($digest), "mail_to_file"));
     }
 }
开发者ID:xenocrat,项目名称:chyrp-mail_to_file,代码行数:8,代码来源:mail_to_file.php

示例5: test_create_queries_with_alternate_columns

 public function test_create_queries_with_alternate_columns()
 {
     $fname = path('symmetric.csv');
     $this->assertTrue($this->csv->uses($fname));
     $columns = array('header_a', 'header_c');
     $res = $this->csv->createQueries('test_table', $columns);
     $this->assertEquals(fix('alternated_header_queries'), $res);
 }
开发者ID:webds,项目名称:php-csv-parser,代码行数:8,代码来源:File_CSV_GetSqlTest.php

示例6: format_dialogue

 public function format_dialogue($text, $post = null)
 {
     if (isset($post)) {
         $post->dialogue_unformatted = $text;
     }
     $split = explode("\n", $text);
     $return = '<ul class="dialogue">';
     $count = 0;
     $my_name = "";
     $links = array();
     foreach ($split as $line) {
         # Remove the timstamps
         $line = preg_replace("/[ ]?[\\[|\\(]?[0-9]{1,2}:[0-9]{2}(:[0-9]{2})?[ ]?(pm|am)?[\\]|\\)]?[ ]?/i", "", $line);
         preg_match("/(<?)(.+)(:|>)\\s*(.+)/i", $line, $matches);
         if (empty($matches)) {
             continue;
         }
         if (preg_match("/\\s*\\(([^\\)]+)\\)\$/", $matches[2], $attribution)) {
             if ($attribution[1] == "me") {
                 $my_name = $matches[2] = str_replace($attribution[0], "", $matches[2]);
             } else {
                 $matches[2] = str_replace($attribution[0], "", $matches[2]);
                 $links[$matches[2]] = $attribution[1];
             }
         }
         $link = oneof(@$links[$matches[2]], "");
         $me = $my_name == $matches[2] ? " me" : "";
         $username = $matches[1] . $matches[2] . $matches[3];
         $class = $count % 2 ? "even" : "odd";
         $return .= '<li class="' . $class . $me . '">';
         if (!empty($link)) {
             $return .= '<span class="label">' . $matches[1] . '<a href="' . $link . '">' . fix($matches[2], false) . '</a>' . $matches[3] . '</span> ' . $matches[4] . "\n";
         } else {
             $return .= '<span class="label">' . fix($username, false) . '</span> ' . $matches[4] . "\n";
         }
         $return .= '</li>';
         $count++;
     }
     $return .= "</ul>";
     # If they're previewing.
     if (!isset($post)) {
         $return = preg_replace("/(<li class=\"(even|odd) me\"><span class=\"label\">)(.+)(<\\/span> (.+)\n<\\/li>)/", "\\1<strong>\\3</strong>\\4", $return);
     }
     return $return;
 }
开发者ID:eadz,项目名称:chyrp,代码行数:45,代码来源:chat.php

示例7: __construct

 /**
  * Function: __construct
  * See Also:
  *     <Model::grab>
  */
 public function __construct($message_id, $options = array())
 {
     if (!isset($message_id) and empty($options)) {
         return;
     }
     fallback($options["order"], array("created_at ASC", "id ASC"));
     parent::grab($this, $message_id, $options);
     if ($this->no_results) {
         return false;
     }
     $this->filtered = !isset($options["filter"]) or $options["filter"];
     $trigger = Trigger::current();
     if ($this->filtered) {
         if (!$this->user->group->can("code_in_messages")) {
             $this->body = fix($this->body);
         }
         $trigger->filter($this->body, array("markup_text", "markup_message_text"), $this);
     }
     $trigger->filter($this, "message");
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:25,代码来源:Message.php

示例8: __construct

 /**
  * Function: __construct
  * See Also:
  *     <Model::grab>
  */
 public function __construct($revision_id, $options = array())
 {
     if (!isset($revision_id) and empty($options)) {
         return;
     }
     parent::grab($this, $revision_id, $options);
     $options["order"] = "created_at ASC, id ASC";
     if ($this->no_results) {
         return false;
     }
     $this->changes = YAML::load($this->changes);
     $this->filtered = !isset($options["filter"]) or $options["filter"];
     $trigger = Trigger::current();
     if ($this->filtered) {
         if (!$this->user->group->can("code_in_revisions")) {
             $this->body = fix($this->body);
         }
         $trigger->filter($this->body, array("markup_text", "markup_revision_text"), $this);
     }
     $trigger->filter($this, "revision");
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:26,代码来源:Revision.php

示例9: feathers

 /**
  * Function: feathers
  * Feather enabling/disabling.
  */
 public function feathers()
 {
     if (!Visitor::current()->group->can("toggle_extensions")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable feathers."));
     }
     $config = Config::current();
     $this->context["enabled_feathers"] = $this->context["disabled_feathers"] = array();
     if (!($open = @opendir(FEATHERS_DIR))) {
         return Flash::warning(__("Could not read feathers directory."));
     }
     while (($folder = readdir($open)) !== false) {
         if (!file_exists(FEATHERS_DIR . "/" . $folder . "/" . $folder . ".php") or !file_exists(FEATHERS_DIR . "/" . $folder . "/info.yaml")) {
             continue;
         }
         if (file_exists(FEATHERS_DIR . "/" . $folder . "/locale/" . $config->locale . ".mo")) {
             load_translator($folder, FEATHERS_DIR . "/" . $folder . "/locale/" . $config->locale . ".mo");
         }
         $info = YAML::load(FEATHERS_DIR . "/" . $folder . "/info.yaml");
         fallback($info["name"], $folder);
         fallback($info["version"], "0");
         fallback($info["url"]);
         fallback($info["description"]);
         fallback($info["author"], array("name" => "", "url" => ""));
         fallback($info["help"]);
         $info["description"] = __($info["description"], $folder);
         $info["description"] = preg_replace("/<code>(.+)<\\/code>/se", "'<code>'.fix('\\1').'</code>'", $info["description"]);
         $info["description"] = preg_replace("/<pre>(.+)<\\/pre>/se", "'<pre>'.fix('\\1').'</pre>'", $info["description"]);
         $info["author"]["link"] = !empty($info["author"]["url"]) ? '<a href="' . fix($info["author"]["url"]) . '">' . fix($info["author"]["name"]) . '</a>' : $info["author"]["name"];
         $category = feather_enabled($folder) ? "enabled_feathers" : "disabled_feathers";
         $this->context[$category][$folder] = array("name" => $info["name"], "version" => $info["version"], "url" => $info["url"], "description" => $info["description"], "author" => $info["author"], "help" => $info["help"]);
     }
     $this->display("feathers");
 }
开发者ID:eadz,项目名称:chyrp,代码行数:37,代码来源:Admin.php

示例10: arr2xml

/**
 * Function: arr2xml
 * Recursively adds an array (or object I guess) to a SimpleXML object.
 *
 * Parameters:
 *     &$object - The SimpleXML object to modify.
 *     $data - The data to add to the SimpleXML object.
 */
function arr2xml(&$object, $data)
{
    foreach ($data as $key => $val) {
        if (is_int($key) and (empty($val) or is_string($val) and trim($val) == "")) {
            unset($data[$key]);
            continue;
        }
        if (is_array($val)) {
            if (in_array(0, array_keys($val))) {
                # Numeric-indexed things need to be added as duplicates
                foreach ($val as $dup) {
                    $xml = $object->addChild($key);
                    arr2xml($xml, $dup);
                }
            } else {
                $xml = $object->addChild($key);
                arr2xml($xml, $val);
            }
        } else {
            $object->addChild($key, fix($val, false, false));
        }
    }
}
开发者ID:homebru,项目名称:bandb,代码行数:31,代码来源:helpers.php

示例11: search

 /**
  * Function: search
  * Grabs the posts for a search query.
  */
 public function search()
 {
     fallback($_GET['query'], "");
     $config = Config::current();
     if ($config->clean_urls and substr_count($_SERVER['REQUEST_URI'], "?") and !substr_count($_SERVER['REQUEST_URI'], "%2F")) {
         # Searches with / and clean URLs = server 404
         redirect("search/" . urlencode($_GET['query']) . "/");
     }
     if (empty($_GET['query'])) {
         return Flash::warning(__("Please enter a search term."));
     }
     list($where, $params) = keywords($_GET['query'], "post_attributes.value LIKE :query OR url LIKE :query", "posts");
     $results = Post::find(array("placeholders" => true, "where" => $where, "params" => $params));
     $ids = array();
     foreach ($results[0] as $result) {
         $ids[] = $result["id"];
     }
     if (!empty($ids)) {
         $posts = new Paginator(Post::find(array("placeholders" => true, "where" => array("id" => $ids))), $this->post_limit);
     } else {
         $posts = new Paginator(array());
     }
     $this->display(array("pages/search", "pages/index"), array("posts" => $posts, "search" => $_GET['query']), fix(_f("Search results for \"%s\"", array($_GET['query']))));
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:28,代码来源:Main.php

示例12: function

<?php

$iterator = new \CallbackFilterIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . '/../src/Bond/')), function (\SplFileInfo $file) {
    return $file->isFile() and $file->getExtension() === 'php';
});
foreach ($iterator as $file) {
    echo fix($file) ? "{$file->getRealPath()}\n" : '';
}
function fix($file)
{
    $contents = file_get_contents($file->getRealPath());
    // rtrim every line
    $string = implode("\n", array_map(function ($line) {
        return rtrim(str_replace("\t", "    ", $line));
    }, explode("\n", $contents)));
    $regex = '/\\v{3,}/m';
    file_put_contents($file->getRealPath(), preg_replace($regex, "\n\n", $string));
    return $contents !== $string;
}
开发者ID:squareproton,项目名称:bond,代码行数:19,代码来源:srcCleanup.php

示例13: __

     $errors[] = __("Password cannot be blank.");
 }
 if ($settings['password_1'] != $settings['password_2']) {
     $errors[] = __("Passwords do not match.");
 }
 if (empty($settings['email'])) {
     $errors[] = __("E-Mail address cannot be blank.");
 }
 if (empty($errors)) {
     if (!$htaccess_has_chyrp) {
         if (!file_exists(MAIN_DIR . "/.htaccess")) {
             if (!@file_put_contents(MAIN_DIR . "/.htaccess", $htaccess)) {
                 $errors[] = _f("Could not generate .htaccess file. Clean URLs will not be available unless you create it and put this in it:\n<pre>%s</pre>", array(fix($htaccess)));
             }
         } elseif (!@file_put_contents(MAIN_DIR . "/.htaccess", "\n\n" . $htaccess, FILE_APPEND)) {
             $errors[] = _f("Could not generate .htaccess file. Clean URLs will not be available unless you create it and put this in it:\n<pre>%s</pre>", array(fix($htaccess)));
         }
     }
     $config->set("sql", array());
     $config->set("name", $settings['name']);
     $config->set("description", $settings['description']);
     $config->set("url", $url);
     $config->set("chyrp_url", $url);
     $config->set("feed_url", "");
     $config->set("email", $settings['email']);
     $config->set("locale", "en_US");
     $config->set("theme", "stardust");
     $config->set("posts_per_page", 5);
     $config->set("feed_items", 20);
     $config->set("clean_urls", false);
     $config->set("post_url", "(year)/(month)/(day)/(url)/");
开发者ID:vito,项目名称:chyrp-site,代码行数:31,代码来源:index.php

示例14: feed_item

 function feed_item($post)
 {
     $config = Config::current();
     foreach ($post->tags as $tag => $clean) {
         echo "        <category scheme=\"" . $config->url . "/tag/\" term=\"" . $clean . "\" label=\"" . fix($tag) . "\" />\n";
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:7,代码来源:tags.php

示例15: register

 /**
  * Function: register
  * Process registration. If registration is disabled or if the user is already logged in, it will error.
  */
 public function register()
 {
     $config = Config::current();
     if (!$config->can_register) {
         error(__("Registration Disabled"), __("I'm sorry, but this site is not allowing registration."));
     }
     if (logged_in()) {
         error(__("Error"), __("You're already logged in."));
     }
     if (!empty($_POST)) {
         if (empty($_POST['login'])) {
             Flash::warning(__("Please enter a username for your account."));
         } elseif (count(User::find(array("where" => array("login" => $_POST['login']))))) {
             Flash::warning(__("That username is already in use."));
         }
         if (empty($_POST['password1'])) {
             Flash::warning(__("Password cannot be blank."));
         } elseif ($_POST['password1'] != $_POST['password2']) {
             Flash::warning(__("Passwords do not match."));
         }
         if (empty($_POST['email'])) {
             Flash::warning(__("E-mail address cannot be blank."));
         } elseif (!preg_match("/^[_A-z0-9-]+((\\.|\\+)[_A-z0-9-]+)*@[A-z0-9-]+(\\.[A-z0-9-]+)*(\\.[A-z]{2,4})\$/", $_POST['email'])) {
             Flash::warning(__("Invalid e-mail address."));
         }
         if ($config->enable_recaptcha and !check_captcha()) {
             Flash::warning(__("Incorrect captcha code. Please try again."));
         }
         if (!Flash::exists("warning")) {
             if ($config->email_activation) {
                 $to = $_POST['email'];
                 $subject = _f($config->name . " Registration Pending");
                 $message = _f("Hello, " . fix($_POST['login']) . ".\n\nYou are receiving this message because you recently registered at " . $config->chyrp_url . "\nTo complete your registration, go to " . $config->chyrp_url . "/?action=validate&login=" . fix($_POST['login']) . "&token=" . sha1($_POST['login'] . $_POST['email']));
                 $headers = "From:" . $config->email . "\r\n" . "Reply-To:" . $config->email . "\r\n" . "X-Mailer: PHP/" . phpversion();
                 $user = User::add($_POST['login'], $_POST['password1'], $_POST['email'], "", "", 5, false);
                 $sent = email($to, $subject, $message, $headers);
                 if ($sent) {
                     Flash::notice(__("The email address you provided has been sent details to confirm registration."), "/");
                 } else {
                     Flash::notice(__("There was an error emailing the activation link to your email address."), "/");
                 }
             } else {
                 $user = User::add($_POST['login'], $_POST['password1'], $_POST['email']);
                 Trigger::current()->call("user_registered", $user);
                 $_SESSION['user_id'] = $user->id;
                 Flash::notice(__("Registration successful."), "/");
             }
         }
     }
     $this->display("forms/user/register", array(), __("Register"));
 }
开发者ID:betsyzhang,项目名称:chyrp,代码行数:55,代码来源:Main.php


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