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


PHP wire函数代码示例

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


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

示例1: checkIfModuleExistsLocally

 private function checkIfModuleExistsLocally($module, $output, $input)
 {
     if (!wire('modules')->get($module)) {
         $output->writeln("<comment>Cannot find '{$module}' locally, trying to download...</comment>");
         $this->passOnToModuleDownloadCommand($module, $output, $input);
     }
 }
开发者ID:samuell,项目名称:wireshell,代码行数:7,代码来源:ModuleEnableCommand.php

示例2: getInputfield

 /**
  * Return new instance of the Inputfield associated with this Fieldtype
  *
  * Abstract Template Method: child classes should override this. Code snippet is for example purposes only. 
  *
  * Page and Field are provided as params in case the Fieldtype needs them for any custom population with the Inputfield.
  * However, most Fieldtypes won't need them since Inputfield objects don't have any Page dependencies (!)
  * The Field class handles setting all standard Inputfield attributes rather than this method to reduce code duplication in Inputfield modules. 
  *
  * (!) See FieldtypeFile for an example that uses both Page and Field params. 
  *
  * @param Page $page 
  * @param Field $field
  * @return Inputfield
  *
  */
 public function getInputfield(Page $page, Field $field)
 {
     // TODO make this abstract
     $inputfield = wire('modules')->get('InputfieldText');
     $inputfield->class = $this->className();
     return $inputfield;
 }
开发者ID:gusdecool,项目名称:bunga-wire,代码行数:23,代码来源:Fieldtype.php

示例3: listIncomingInvoice

function listIncomingInvoice()
{
    $faelligrechnung = wire('pages')->get("/rechnungen/vorgaenge/")->children("invoiceVorgangsart=R,buchungKontenInaktiv=0, include=hidden, universalCheck=0");
    $heute = time();
    foreach ($faelligrechnung as $faellig) {
        $datumstring = explode("-", $faellig->datum);
        $datumstring[1]++;
        $formatDatum = $datumstring[2] . '-' . $datumstring[0] . '-' . $datumstring[1];
        //YYYY MM DD
        $rechnungsdatum = strtotime($formatDatum);
        $differenz = $rechnungsdatum - $heute;
        $diff_tage = $differenz / 86400;
        $tagedifferenz = floor($diff_tage);
        if ($tagedifferenz >= "0" && $tagedifferenz <= "8") {
            if ($tagedifferenz == 0) {
                $tagedifferenz = "heute";
            }
            if ($tagedifferenz > 1) {
                $noch = "in ";
                $tagedifferenz = $noch . ($tagedifferenz .= " Tagen");
            }
            if ($tagedifferenz == 1) {
                $tagedifferenz = "Morgen";
            }
            echo "<li><a href='{$faellig->url}'>{$faellig->title} - {$tagedifferenz}</a></li>";
        }
    }
}
开发者ID:ribpet,项目名称:Officesuite,代码行数:28,代码来源:home.php

示例4: renderTopNavItems

 /**
  * Render top navigation items
  * 
  * @return string
  * 
  * @todo: Renobird: the $userImg variable is currently unused--did you want to use that?
  * 
  */
 public function renderTopNavItems()
 {
     $out = '';
     $user = $this->wire('user');
     $config = wire("config");
     $adminTheme = $this->wire('adminTheme');
     $adminTheme->avatar_field != '' ? $imgField = $user->get($adminTheme->avatar_field) : ($imgField = '');
     if ($imgField != '') {
         count($imgField) ? $img = $imgField->first() : ($img = $imgField);
         $out .= "<li class='avatar'><a href='{$config->urls->admin}profile/'>";
         $userImg = $img->size(52, 52);
         // render at 2x for hi-dpi (52x52 for 26x26)
         $out .= "<img src='{$userImg->url}' alt='{$user->name}' /> <span>{$user->name}</span>";
         $out .= "</a></li>";
     } else {
         $title = $this->_('Profile');
         $out .= "<li><a title='{$title}' href='{$config->urls->admin}profile/'><i class='fa fa-user'></i> <span>{$user->name}</span></a></li>";
     }
     // view site
     $out .= "<li><a href='{$config->urls->root}'><i class='fa {$adminTheme->home}'></i></a></li>";
     // logout
     $label = $this->_('Logout');
     $out .= "<li><a title='{$label}' href='{$config->urls->admin}login/logout/'><i class='fa {$adminTheme->signout}'></i></a></li>";
     return $out;
 }
开发者ID:avatar382,项目名称:fablab_site,代码行数:33,代码来源:AdminThemeRenoHelpers.php

示例5: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     parent::bootstrapProcessWire($output);
     $names = explode(',', $input->getArgument('name'));
     $templates = wire('templates');
     $fieldgroups = wire('fieldgroups');
     foreach ($names as $name) {
         $template = $templates->get($name);
         if ($template->id) {
             // try to delete depending file?
             if (!$input->getOption('nofile') && file_exists($template->filename)) {
                 unlink($template->filename);
             }
             $template->flags = \Template::flagSystemOverride;
             $template->flags = 0;
             // all flags now removed, can be deleted
             $templates->delete($template);
             // delete depending fieldgroups
             $fg = $fieldgroups->get($name);
             if ($fg->id) {
                 $fieldgroups->delete($fg);
             }
             $output->writeln("<info>Template '{$name}' deleted successfully!</info>");
         } else {
             $output->writeln("<error>Template '{$name}' doesn't exist!</error>");
         }
     }
 }
开发者ID:samuell,项目名称:wireshell,代码行数:33,代码来源:TemplateDeleteCommand.php

示例6: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::bootstrapProcessWire($output);
     $dev = $input->getOption('dev') ? true : false;
     $check = parent::checkForCoreUpgrades($output, $dev);
     $this->output = $output;
     $this->root = wire('config')->paths->root;
     if ($check['upgrade'] && $input->getOption('just-check') === false) {
         if (!extension_loaded('pdo_mysql')) {
             $this->output->writeln("<error>Your PHP is not compiled with PDO support. PDO is required by ProcessWire 2.4+.</error>");
         } elseif (!class_exists('ZipArchive')) {
             $this->output->writeln("<error>Your PHP does not have ZipArchive support. This is required to install core or module upgrades with this tool.</error>");
         } elseif (!is_writable($this->root)) {
             $this->output->writeln("<error>Your file system is not writable.</error>");
         } else {
             $this->fs = new Filesystem();
             $this->projectDir = $this->fs->isAbsolutePath($this->root) ? $this->root : getcwd() . DIRECTORY_SEPARATOR . $this->root;
             $this->branch = $check['branch'];
             try {
                 $this->download()->extract()->move()->cleanup()->replace($input->getOption('just-download'), $input, $output);
             } catch (Exception $e) {
             }
         }
     }
 }
开发者ID:samuell,项目名称:wireshell,代码行数:30,代码来源:UpgradeCommand.php

示例7: checkForCoreUpgrades

 /**
  * @param $output
  * @param boolean $dev
  * @return boolean
  */
 protected function checkForCoreUpgrades($output, $dev = false)
 {
     $branches = $this->getCoreBranches();
     $master = $branches['master'];
     $upgrade = false;
     $new = version_compare($master['version'], wire('config')->version);
     if ($new > 0 && $dev === false) {
         // master is newer than current
         $branch = $master;
         $upgrade = true;
     } else {
         if ($new <= 0 || $new > 0 && $dev === true) {
             // we will assume dev branch
             $dev = $branches['dev'];
             $new = version_compare($dev['version'], wire('config')->version);
             $branch = $dev;
             if ($new > 0) {
                 $upgrade = true;
             }
         }
     }
     $versionStr = "{$branch['name']} {$branch['version']}";
     if ($upgrade) {
         $output->writeln("<info>A ProcessWire core upgrade is available: {$versionStr}</info>");
     } else {
         $output->writeln("<info>Your ProcessWire core is up-to-date: {$versionStr}</info>");
     }
     return array('upgrade' => $upgrade, 'branch' => $branch);
 }
开发者ID:samuell,项目名称:wireshell,代码行数:34,代码来源:PwConnector.php

示例8: renderCommentsRSS

/**
 * Output an RSS feed of recent comments when URL segment is 'rss'
 *
 */
function renderCommentsRSS($limit)
{
    // selector to locate the comments we want
    $start = 0;
    $selector = "limit={$limit}, start={$start}, sort=-created, status>=" . Comment::statusApproved;
    // find the comments we want to output
    $comments = findComments($selector);
    $commentPages = new PageArray();
    foreach ($comments as $comment) {
        $p = wire('pages')->get($comment->pages_id);
        if (!$p->id) {
            continue;
        }
        $p = clone $p;
        $p->comment_title = htmlentities($comment->cite, ENT_QUOTES, "UTF-8") . " reply to: " . $p->title;
        $p->comment_body = htmlentities($comment->text, ENT_QUOTES, "UTF-8");
        $p->comment_date = $comment->created;
        $commentPages->add($p);
    }
    $rss = wire('modules')->get('MarkupRSS');
    $rss->title = wire('pages')->get('/')->headline . ' - ' . wire('page')->get('headline|title');
    $rss->itemTitleField = 'comment_title';
    $rss->itemDescriptionField = 'comment_body';
    $rss->itemDescriptionLength = 0;
    $rss->itemDateField = 'comment_date';
    $rss->render($commentPages);
}
开发者ID:josedigital,项目名称:grumpycooker,代码行数:31,代码来源:comments.php

示例9: set

 public function set($key, $value)
 {
     if ($key == 'lat' || $key == 'lng') {
         // if value isn't numeric, then it's not valid: make it blank
         if (strpos($value, ',') !== false) {
             $value = str_replace(',', '.', $value);
         }
         // convert 123,456 to 123.456
         if (!is_numeric($value)) {
             $value = '';
         }
     } else {
         if ($key == 'address') {
             $value = wire('sanitizer')->text($value);
         } else {
             if ($key == 'status') {
                 $value = (int) $value;
                 if (!isset($this->geocodeStatuses[$value])) {
                     $value = -1;
                 }
                 // -1 = unknown
             } else {
                 if ($key == 'zoom') {
                     $value = (int) $value;
                 }
             }
         }
     }
     return parent::set($key, $value);
 }
开发者ID:ryancramerdesign,项目名称:FieldtypeMapMarker,代码行数:30,代码来源:MapMarker.php

示例10: checkIfFieldExists

 /**
  * @param $field
  * @param $output
  * @return bool
  */
 private function checkIfFieldExists($field, $output)
 {
     if (!wire("fields")->get("{$field}")) {
         $output->writeln("<error>Field '{$field}' does not exist!</error>");
         return false;
     }
 }
开发者ID:samuell,项目名称:wireshell,代码行数:12,代码来源:TemplateFieldsCommand.php

示例11: __construct

 function __construct()
 {
     $userFields = wire('templates')->get('user')->fields;
     $userFieldsArray = [];
     $userFieldsArray['name'] = 'name';
     foreach ($userFields as $field) {
         if (!in_array($field->name, ['pass', 'roles', 'language'])) {
             $userFieldsArray[$field->id] = $field->name;
         }
     }
     $this->add(array(array('name' => 'fieldname', 'label' => __('Validation field'), 'required' => true, 'type' => 'Select', 'options' => $userFieldsArray, 'description' => __('The field to match user registration against.'))));
     if (class_exists("LanguageSupport", false)) {
         foreach ($this->languages as $language) {
             $this->add(array(array('name' => 'instructions' . $language->id, 'label' => __('Instructions') . " ({$language->name})", 'description' => __('Optional text displayed under the reset form validation field.'), 'type' => 'CKEditor')));
         }
     } else {
         $this->add(array(array('name' => 'instructions', 'label' => __('Instructions'), 'type' => 'CKEditor', 'description' => __('Optional text displayed under the reset form validation field.'))));
     }
     $this->add(array(array('name' => 'emailAddress', 'label' => __('Email address to send reset link from'), 'required' => true, 'type' => 'Text', 'value' => 'passwords-service@example.com'), array('name' => 'emailName', 'label' => __('Name to use for the email address'), 'type' => 'Text', 'value' => 'Passwords service'), array('name' => 'passwordLength', 'label' => __('Required password length'), 'required' => true, 'type' => 'Integer', 'value' => 8)));
     if (class_exists("LanguageSupport", false)) {
         foreach ($this->languages as $language) {
             $this->add(array(array('name' => 'passwordInstructions' . $language->id, 'label' => __('Password instructions') . " ({$language->name})", 'description' => __('Optional (but strongly recommended) instructions displayed under the password input field.'), 'type' => 'CKEditor')));
         }
     } else {
         $this->add(array(array('name' => 'passwordInstructions', 'label' => __('Password instructions'), 'description' => __('Optional (but strongly recommended) instructions displayed under the password input field.'), 'type' => 'CKEditor')));
     }
 }
开发者ID:plauclair,项目名称:PasswordReset,代码行数:27,代码来源:PasswordResetConfig.php

示例12: renderNavTree

/** 
 * Given a group of pages render a tree of navigation
 *
 * @param Page|PageArray $items Page to start the navigation tree from or pages to render
 * @param int $maxDepth How many levels of navigation below current should it go?
 *
 */
function renderNavTree($items, $maxDepth = 3)
{
    // if we've been given just one item, convert it to an array of items
    if ($items instanceof Page) {
        $items = array($items);
    }
    // if there aren't any items to output, exit now
    if (!count($items)) {
        return;
    }
    // $out is where we store the markup we are creating in this function
    // start our <ul> markup
    echo "<ul class='nav nav-tree'>";
    // cycle through all the items
    foreach ($items as $item) {
        // markup for the list item...
        // if current item is the same as the page being viewed, add a "current" class to it
        if ($item->id == wire('page')->id) {
            echo "<li class='current'>";
        } else {
            echo "<li>";
        }
        // markup for the link
        echo "<a href='{$item->url}'>{$item->title}</a>";
        // if the item has children and we're allowed to output tree navigation (maxDepth)
        // then call this same function again for the item's children
        if ($item->hasChildren() && $maxDepth) {
            renderNavTree($item->children, $maxDepth - 1);
        }
        // close the list item
        echo "</li>";
    }
    // end our <ul> markup
    echo "</ul>";
}
开发者ID:Rizsti,项目名称:Processwire_Compatibility,代码行数:42,代码来源:_init.php

示例13: gate

function gate($w)
{
    global $gates;
    if (is_numeric($gates[$w])) {
        return $gates[$w];
    }
    if (strpos($gates[$w], ' ') === false) {
        return wire($gates[$w]);
    }
    if (preg_match("#NOT ([\\d\\w]+)#", $gates[$w], $matches1)) {
        return is_numeric($matches1[1]) ? ~(int) $matches1[1] & 65535 : ~(int) wire($matches1[1]) & 65535;
    }
    if (preg_match("#([\\d\\w]+) (AND|OR|LSHIFT|RSHIFT) ([\\d\\w]+)#", $gates[$w], $matches3)) {
        $a = is_numeric($matches3[1]) ? $matches3[1] : wire($matches3[1]);
        $b = is_numeric($matches3[3]) ? $matches3[3] : wire($matches3[3]);
        switch ($matches3[2]) {
            case 'AND':
                return $a & $b & 65535;
            case 'OR':
                return $a | $b & 65535;
            case 'LSHIFT':
                return $a << $b & 65535;
            case 'RSHIFT':
                return $a >> $b & 65535;
        }
    }
}
开发者ID:alkemann,项目名称:advent2016,代码行数:27,代码来源:ciruits.php

示例14: __construct

 /**
  * Construct the translator and set the current language
  *
  */
 public function __construct(Language $currentLanguage)
 {
     $this->setCurrentLanguage($currentLanguage);
     $this->rootPath = wire('config')->paths->root;
     $file = __FILE__;
     $pos = strpos($file, '/wire/modules/LanguageSupport/');
     $this->rootPath2 = $pos ? substr($file, 0, $pos + 1) : '';
 }
开发者ID:avatar382,项目名称:fablab_site,代码行数:12,代码来源:LanguageTranslator.php

示例15: renderCategories

/**
 * Render a list of categories, optionally showing a few posts from each
 *
 * @param PageArray $categories
 * @param int Number of posts to show from each category (default=0)
 * @return string
 *
 */
function renderCategories(PageArray $categories, $showNumPosts = 0)
{
    foreach ($categories as $category) {
        $category->posts = wire('pages')->find("template=post, categories={$category}, limit={$showNumPosts}, sort=-date");
    }
    $t = new TemplateFile(wire('config')->paths->templates . 'markup/categories.php');
    $t->set('categories', $categories);
    return $t->render();
}
开发者ID:josedigital,项目名称:grumpycooker,代码行数:17,代码来源:categories.php


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