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


PHP io类代码示例

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


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

示例1: process

 function process()
 {
     Console::initCore();
     if ($r = ArgsHolder::get()->getOption('count')) {
         $this->count = $r;
     }
     if (($c = ArgsHolder::get()->shiftCommand()) == 'help') {
         return $this->cmdHelp();
     }
     try {
         IO::out("");
         $sql = 'SELECT * FROM ' . self::TABLE . ' where not isnull(finished_at) and not 
             isnull(locked_at) and isnull(failed_at) ORDER BY run_at DESC';
         if ($this->count) {
             $list = DB::query($sql . ' LIMIT ' . $this->count);
         } else {
             $list = DB::query($sql);
         }
         if (!count($list)) {
             IO::out("No finished work!", IO::MESSAGE_FAIL);
             return;
         }
         io::out(sprintf("%-10s %-7s %-3s %-20s %-20s %-19s %-4s %-5s", "~CYAN~id", "queue", "pr", "run_at", "locked_at", "finished_at", "att", "call_to~~~"));
         foreach ($list as $l) {
             $handler = unserialize($l["handler"]);
             io::out(sprintf("%-4s %-7s %-3s %-20s %-20s %-20s %-3s %-5s", $l["id"], $l["queue"], $l["priority"], $l["run_at"], $l["locked_at"], $l["finished_at"], $l["attempts"], $handler["class"] . "::" . $handler["method"] . "(...)"));
         }
     } catch (Exception $e) {
         io::out($e->getMessage(), IO::MESSAGE_FAIL);
         return;
     }
     IO::out("");
 }
开发者ID:point,项目名称:cassea,代码行数:33,代码来源:CmdBgworkCompleted.php

示例2: RestartById

 public function RestartById($c)
 {
     if (!count(DB::query('SELECT * from ' . self::TABLE . ' WHERE id="' . $c . '"'))) {
         io::out("Work with id={$c} is not exists", IO::MESSAGE_FAIL);
         return;
     }
     $list = DB::query('SELECT * FROM ' . self::TABLE . ' where isnull(finished_at) and not 
         isnull(locked_at) and isnull(failed_at) and id=' . $c . ' ORDER BY run_at DESC');
     if (count($list)) {
         IO::out("This is working now...You cant restart!", IO::MESSAGE_FAIL);
         return;
     }
     if (IO::YES == io::dialog('Do you really want to restart work with id ' . $c . '?', IO::NO | IO::YES, IO::NO)) {
         DB::query("UPDATE " . self::TABLE . " set attempts='1',finished_at=null, locked_at=null, \n                failed_at=null, run_at=now()  WHERE  id='" . $c . "'");
         $php_path = exec("which php");
         if (empty($php_path)) {
             return $this->log("###" . date("c") . " Call from console PHP executable not found");
         }
         if (!is_executable($php_path)) {
             return $this->log("###" . date("c") . " Call from console {$php_path} could not be executed");
         }
         exec($php_path . ' ' . trim(escapeshellarg(Config::get('ROOT_DIR') . "/vendors/delayedjob/JobHandler.php"), "'") . ' >> ' . Config::get('ROOT_DIR') . '/logs/delayedjob.log 2>&1 &');
         io::done('Restarting...');
     } else {
         io::done('Cancel restart');
     }
     IO::out("");
 }
开发者ID:point,项目名称:cassea,代码行数:28,代码来源:CmdBgworkRestart.php

示例3: anchorStart

 /**
  * Output the anchor start tag
  *
  * @return string the HTML content
  * @access private
  */
 function anchorStart($tagName, $anchor, $attributes)
 {
     if (strpos($_SERVER['SCRIPT_NAME'], PATH_ADMIN_WR) !== false && strpos($_SERVER['SCRIPT_NAME'], 'page-previsualization.php') === false) {
         return '<' . $tagName . ' href="' . $anchor . '"' . $attributes . '>';
     }
     return '<' . $tagName . ' href="' . (pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_BASENAME) != 'index.php' ? $_SERVER['SCRIPT_NAME'] : pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME) . (pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME) == '/' ? '' : '/')) . (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] ? '?' . io::htmlspecialchars($_SERVER["QUERY_STRING"]) : '') . $anchor . '"' . $attributes . '>';
 }
开发者ID:davidmottet,项目名称:automne,代码行数:13,代码来源:anchor.php

示例4: __construct

 /**
  * Setup and configure the benchmark library class.
  */
 public function __construct()
 {
     // Run the first benchmark
     self::mark('init');
     // Register shortcut aliases using io::method();
     \io::alias(__CLASS__, get_class_methods(__CLASS__));
 }
开发者ID:olscore,项目名称:ornithopter.io,代码行数:10,代码来源:benchmark.php

示例5: _compute

    /**
     * Compute the tag
     *
     * @return string the PHP / HTML content computed
     * @access private
     */
    protected function _compute()
    {
        //decode ampersand
        $this->_attributes['what'] = io::decodeEntities($this->_attributes['what']);
        $return = '
		$ifcondition_' . $this->_uniqueID . ' = CMS_polymod_definition_parsing::replaceVars("' . $this->replaceVars($this->_attributes['what'], false, false, array($this, 'encloseWithPrepareVar')) . '", @$replace);
		';
        //if attribute name is set, store if result
        if (isset($this->_attributes['name']) && $this->_attributes['name']) {
            $return .= '$atmIfResults[\'' . $this->_attributes['name'] . '\'][\'if\'] = false;';
        }
        $return .= '
		if ($ifcondition_' . $this->_uniqueID . '):
			$func_' . $this->_uniqueID . ' = @create_function("","return (".$ifcondition_' . $this->_uniqueID . '.");");
			if ($func_' . $this->_uniqueID . ' === false) {
				CMS_grandFather::raiseError(\'Error in atm-if [' . $this->_uniqueID . '] syntax : \'.$ifcondition_' . $this->_uniqueID . ');
			}
			if ($func_' . $this->_uniqueID . ' && $func_' . $this->_uniqueID . '()):
			';
        //if attribute name is set, store if result
        if (isset($this->_attributes['name']) && $this->_attributes['name']) {
            $return .= '$atmIfResults[\'' . $this->_attributes['name'] . '\'][\'if\'] = true;';
        }
        $return .= '
				' . $this->_computeChilds() . '
			endif;
			unset($func_' . $this->_uniqueID . ');
		endif;
		unset($ifcondition_' . $this->_uniqueID . ');
		';
        return $return;
    }
开发者ID:davidmottet,项目名称:automne,代码行数:38,代码来源:if.php

示例6: __construct

 /**
  * Constructor.
  * initializes the linxCondition.
  *
  * @param string $property The page property we're gonna test. Only a set of these are available here.
  * @param string $operator The comparison operator serving to test the condition.
  * @param string $tagContent The tag content.
  * @return void
  * @access public
  */
 function __construct($tag)
 {
     $authorized_properties = array("rank", "title", "id", "lvl", "father", "website", "codename");
     $property = $tag->getAttribute('property');
     $operator = $tag->getAttribute('operator');
     if (SensitiveIO::isInSet($property, $authorized_properties)) {
         $this->_pageProperty = $property;
         $this->_operator = io::decodeEntities(io::decodeEntities(io::decodeEntities($operator)));
         $values = $tag->getElementsByTagName('value');
         if ($values->length > 0) {
             $value = $values->item(0);
             //if value type is "nodeproperty", we must parse the inner content to find a nodespec tag
             if ($value->hasAttribute("type") && $value->getAttribute("type") == "nodeproperty") {
                 $this->_valueIsScalar = false;
                 $this->_valueNodespecProperty = $value->getAttribute("property");
                 $nodespecs = $value->getElementsByTagName('nodespec');
                 if ($nodespecs->length > 0) {
                     $nodespec = $nodespecs->item(0);
                     $this->_valueNodespec = CMS_linxNodespec::createNodespec($nodespec);
                 }
             } else {
                 $this->_valueScalar = $value->nodeValue;
             }
         } else {
             $this->raiseError("Malformed innerContent");
             return;
         }
     } else {
         $this->raiseError("Unknown property : " . $property);
     }
 }
开发者ID:davidmottet,项目名称:automne,代码行数:41,代码来源:linxcondition.php

示例7: process

 function process()
 {
     Console::initCore();
     if (($c = ArgsHolder::get()->shiftCommand()) == 'help') {
         return $this->cmdHelp();
     }
     try {
         $format = "%-25s %s";
         IO::out("");
         $s = DB::query('SELECT * FROM ' . self::TABLE . ' where id="' . $c . '"');
         if (!count($s)) {
             io::out("Work with id={$c} is not exists", IO::MESSAGE_FAIL);
             return;
         }
         io::out(sprintf($format, "~CYAN~id~~~", $c));
         io::out(sprintf($format, "~CYAN~queue~~~", $this->emp($s[0]['queue'])));
         io::out(sprintf($format, "~CYAN~priority~~~", $this->emp($s[0]['priority'])));
         io::out(sprintf($format, "~CYAN~run at~~~", $this->emp($s[0]['run_at'])));
         io::out(sprintf($format, "~CYAN~locked at~~~", $this->emp($s[0]['locked_at'])));
         io::out(sprintf($format, "~CYAN~finished at~~~", $this->emp($s[0]['finished_at'])));
         io::out(sprintf($format, "~CYAN~failed at~~~", $this->emp($s[0]['failed_at'])));
         io::out(sprintf($format, "~CYAN~attemts~~~", $this->emp($s[0]['attempts'])));
         $handler = unserialize($s[0]["handler"]);
         io::out(sprintf($format, "~CYAN~call~~~", $handler["class"] . "::" . $handler["method"]) . "(...)");
         if (isset($handler["param"])) {
             io::out(sprintf($format, "~CYAN~params~~~", trim(self::walker($handler['param']), ',')));
         }
     } catch (Exception $e) {
         io::out($e->getMessage(), IO::MESSAGE_FAIL);
         return;
     }
     IO::out("");
 }
开发者ID:point,项目名称:cassea,代码行数:33,代码来源:CmdBgworkSingle.php

示例8: __construct

 /**
  * Initialize file helper class.
  *
  * @return object
  */
 public function __construct()
 {
     // By default exclude annoying files
     self::exclusive();
     // Register shortcut aliases using h::method();
     \io::alias(__CLASS__, get_class_methods(__CLASS__));
 }
开发者ID:olscore,项目名称:ornithopter.io,代码行数:12,代码来源:file.php

示例9: create

 public static function create($campaignId, $data = array())
 {
     if (!io::isPositiveInteger($campaignId)) {
         return false;
     }
     $sql = 'INSERT INTO mod_mailjet VALUES (' . $campaignId . ',"' . json_encode($data) . '");';
     $query = new CMS_query($sql);
     return !$query->hasError();
 }
开发者ID:arthurgorjux,项目名称:mailjetAutomne,代码行数:9,代码来源:MailjetCampaign.php

示例10: countByCodename

 public static function countByCodename($codename, $id = null)
 {
     $sql = 'SELECT count(*) as count from mod_object_oembed_definition where codename_mood = "' . io::sanitizeSQLString($codename) . '"';
     if ($id) {
         $sql .= ' AND id_mood <> ' . $id;
     }
     $query = new CMS_query($sql);
     $data = array_pop($query->getAll());
     return (int) $data['count'];
 }
开发者ID:davidmottet,项目名称:automne,代码行数:10,代码来源:poly_oembed_definition_catalog.php

示例11: setValue

 /**
  * Sets the string value.
  *
  * @param string $value the string value to set
  * @return boolean true on success, false on failure
  * @access public
  */
 function setValue($value)
 {
     //add some complementary checks on values
     if ($value && io::strlen($value) > 255) {
         $this->raiseError("Setting a too long string for string value : max 255 cars, set : " . io::strlen($value));
         return false;
     }
     $this->_value = $value;
     return true;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:17,代码来源:subobject_string.php

示例12: CmdList

 function CmdList()
 {
     io::out('~WHITE~Current env~~~: ' . ($env = EnvManager::getCurrent()));
     io::out();
     IO::OUt('~WHITE~Avaible enviroments:~~~');
     foreach (EnvManager::envList() as $e) {
         if ($e != $env) {
             io::out('    ' . $e);
         }
     }
 }
开发者ID:point,项目名称:cassea,代码行数:11,代码来源:CmdEnv.php

示例13: getObjectsNames

 /**
  * Gets all available objects class names
  *
  * @return array(string "CMS_object_{type}")
  * @access public
  * @static
  */
 function getObjectsNames()
 {
     //Automatic listing
     $excludedFiles = array('object_catalog.php', 'object_common.php');
     $packages_dir = dir(PATH_MODULES_FS . '/' . MOD_POLYMOD_CODENAME . '/objects/');
     while (false !== ($file = $packages_dir->read())) {
         if (io::substr($file, -4) == ".php" && !in_array($file, $excludedFiles) && class_exists('CMS_' . io::substr($file, 0, -4))) {
             $objectsCatalog[] = 'CMS_' . io::substr($file, 0, -4);
         }
     }
     return $objectsCatalog;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:19,代码来源:object_catalog.php

示例14: deleteQueue

 public function deleteQueue($c)
 {
     if (!DB::query('SELECT id from ' . self::TABLE . ' WHERE queue="' . $c . '"')) {
         io::out("Queue {$c} is not exists", IO::MESSAGE_FAIL);
         return;
     }
     if (IO::YES == io::dialog('Realy you really want to delete all jobs with queue ' . $c . '?', IO::NO | IO::YES, IO::NO)) {
         DB::query("DELETE FROM " . self::TABLE . " WHERE  queue='" . $c . "'");
         io::done('Deleting...');
     } else {
         io::done('Cancel delete');
     }
 }
开发者ID:point,项目名称:cassea,代码行数:13,代码来源:CmdBgworkDelete.php

示例15: getTextDefinition

 /**
  * Get the text definition.
  *
  * @return string The text definition based on the current elements
  * @access public
  */
 function getTextDefinition()
 {
     $text = '';
     foreach ($this->_elements as $atom) {
         $text .= $atom[0];
         if ($this->_valuesByAtom == 2) {
             $text .= "," . $atom[1];
         }
         $text .= ";";
     }
     $text = io::substr($text, 0, -1);
     return $text;
 }
开发者ID:davidmottet,项目名称:automne,代码行数:19,代码来源:stack.php


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