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


PHP Feature类代码示例

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


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

示例1: createFeature

 /**
  * Create feature of the given definition.
  *
  * @return Feature
  */
 protected function createFeature()
 {
     $feature = new Feature($this, $this->getId());
     $feature->setProperty('type', lcfirst(static::getType()));
     $feature->setProperty('options', $this->getOptions());
     return $feature;
 }
开发者ID:pfitz,项目名称:php-leaflet,代码行数:12,代码来源:FeatureTrait.php

示例2: setFeatureStatus

 /**
  * Set an individual feature and its status
  *
  * @param string     $featureLabel
  * @param bool|array $status
  */
 public function setFeatureStatus($featureLabel, $status)
 {
     if (isset($this->featureFlags[$featureLabel])) {
         $feature = $this->get($featureLabel);
     } else {
         $feature = new Feature($featureLabel);
     }
     if (is_array($status)) {
         $feature->setStatus($status);
     } else {
         $feature->setBooleanStatus($status);
     }
     $this->featureFlags[$featureLabel] = $feature;
 }
开发者ID:vestd,项目名称:FeatureFlags,代码行数:20,代码来源:FeatureCollection.php

示例3: plans

 /**
  * Show list of plans
  */
 public function plans()
 {
     if (!$this->ion_auth->logged_in()) {
         redirect('/auth');
     }
     $user = $this->getUser();
     $feature = new Feature();
     $plan = new Plan();
     $this->template->layout = 'layouts/customer_settings';
     $this->template->set('features', $feature->get());
     $this->template->set('plans', $plan->getActualPlansWithoutActive($user));
     $this->template->set('user', $user);
     $this->template->set('options', $this->config->config['period_qualifier']);
     $this->template->render();
 }
开发者ID:andrewkrug,项目名称:repucaution,代码行数:18,代码来源:subscript.php

示例4: processFeatures

 public function processFeatures()
 {
     if (!Feature::isFeatureActive()) {
         return;
     }
     if (Validate::isLoadedObject($product = new Product((int) Tools::getValue('id_product')))) {
         // delete all objects
         $product->deleteFeatures();
         // add new objects
         $languages = Language::getLanguages(false);
         foreach ($_POST as $key => $val) {
             if (preg_match('/^feature_([0-9]+)_value/i', $key, $match)) {
                 if (!empty($val)) {
                     foreach ($val as $v) {
                         $product->addFeaturesToDB($match[1], $v);
                     }
                 } else {
                     if ($default_value = $this->checkFeatures($languages, $match[1])) {
                         $id_value = $product->addFeaturesToDB($match[1], 0, 1);
                         foreach ($languages as $language) {
                             if ($cust = Tools::getValue('custom_' . $match[1] . '_' . (int) $language['id_lang'])) {
                                 $product->addFeaturesCustomToDB($id_value, (int) $language['id_lang'], $cust);
                             } else {
                                 $product->addFeaturesCustomToDB($id_value, (int) $language['id_lang'], $default_value);
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $this->errors[] = Tools::displayError('A product must be created before adding features.');
     }
 }
开发者ID:hantonius,项目名称:advancedfeaturesvalues,代码行数:34,代码来源:AdminProductsController.php

示例5: getContent

 function getContent()
 {
     $is_one_dot_five = version_compare(_PS_VERSION_, '1.5', '>');
     // Smarty
     $template_vars = array('id_tab' => Tools::getValue('id_tab'), 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'token' => Tools::getValue('token'), 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), '_module_dir_' => _MODULE_DIR_, 'ebay_categories' => EbayCategoryConfiguration::getEbayCategories($this->ebay_profile->id), 'id_lang' => $this->context->cookie->id_lang, 'id_ebay_profile' => $this->ebay_profile->id, '_path' => $this->path, 'possible_attributes' => AttributeGroup::getAttributesGroups($this->context->cookie->id_lang), 'possible_features' => Feature::getFeatures($this->context->cookie->id_lang, true), 'date' => pSQL(date('Ymdhis')), 'conditions' => $this->_translatePSConditions(EbayCategoryConditionConfiguration::getPSConditions()), 'form_items_specifics' => EbaySynchronizer::getNbSynchronizableEbayCategoryCondition(), 'form_items_specifics_mixed' => EbaySynchronizer::getNbSynchronizableEbayCategoryConditionMixed(), 'isOneDotFive' => $is_one_dot_five);
     return $this->display('formItemsSpecifics.tpl', $template_vars);
 }
开发者ID:kevindesousa,项目名称:ebay,代码行数:7,代码来源:EbayFormItemsSpecificsTab.php

示例6: getContent

 function getContent()
 {
     // Check if the module is configured
     if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) {
         return '<p class="error"><b>' . $this->ebay->l('Please configure the \'General settings\' tab before using this tab') . '</b></p><br /><script type="text/javascript">$("#menuTab4").addClass("wrong")</script>';
     }
     $iso = $this->context->language->iso_code;
     $iso_tiny_mce = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     // Display Form
     $url_vars = array('id_tab' => '4', 'section' => 'template');
     if (version_compare(_PS_VERSION_, '1.5', '>')) {
         $url_vars['controller'] = Tools::getValue('controller');
     } else {
         $url_vars['tab'] = Tools::getValue('tab');
     }
     $action_url = $this->_getUrl($url_vars);
     if (Tools::getValue('reset_template')) {
         $ebay_product_template = EbayProductTemplate::getContent($this->ebay, $this->smarty);
     } else {
         $ebay_product_template = Tools::getValue('ebay_product_template', $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE'));
     }
     $ebay_product_template_title = $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE_TITLE');
     $smarty_vars = array('action_url' => $action_url, 'ebay_product_template' => $ebay_product_template, 'ebay_product_template_title' => $ebay_product_template_title, 'features_product' => Feature::getFeatures($this->context->language->id), 'ad' => dirname($_SERVER['PHP_SELF']), 'base_uri' => __PS_BASE_URI__, 'is_one_dot_three' => Tools::substr(_PS_VERSION_, 0, 3) == '1.3', 'is_one_dot_five' => version_compare(_PS_VERSION_, '1.5', '>'), 'theme_css_dir' => _THEME_CSS_DIR_);
     if (Tools::substr(_PS_VERSION_, 0, 3) == '1.3') {
         $smarty_vars['theme_name'] = _THEME_NAME_;
         $smarty_vars['language'] = file_exists(_PS_ROOT_DIR_ . '/js/tinymce/jscripts/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     } elseif (version_compare(_PS_VERSION_, '1.5', '>')) {
         $smarty_vars['iso'] = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en';
     } else {
         $smarty_vars['iso_type_mce'] = $iso_tiny_mce;
         $smarty_vars['ps_js_dir'] = _PS_JS_DIR_;
     }
     return $this->display('formTemplateManager.tpl', $smarty_vars);
 }
开发者ID:anantha89,项目名称:gpprestashop,代码行数:34,代码来源:EbayFormTemplateManagerTab.php

示例7: create_sql

 public function create_sql($sql_type, $data)
 {
     if (Feature::is_check_user_login($sql_type)) {
         return new Check_user_login_sql($data);
     } else {
         if (Feature::is_add_receipt($sql_type)) {
             return new Add_receipt_sql($data);
         } else {
             if (Feature::is_remove_product($sql_type)) {
                 return new Remove_product_sql($data);
             } else {
                 if (Feature::is_push_alter_product_data($sql_type)) {
                     return new Push_alter_product_data_sql($data);
                 } else {
                     if (Feature::is_push_new_product_data($sql_type)) {
                         return new Push_new_product_data_sql($data);
                     } else {
                         if (Feature::is_get_list_of_product_info($sql_type)) {
                             return new Get_list_of_product_info_sql($data);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:Ruyka,项目名称:Tam-An-Food-Store-Manager,代码行数:26,代码来源:SQLFactory.php

示例8: renderForm

 public function renderForm()
 {
     if (!$this->object->id) {
         $this->object->price = -1;
     }
     $shops = Shop::getShops();
     if (count($this->context->employee->getAssociatedShops()) > 1) {
         $shops = array_merge(array(0 => array('id_shop' => 0, 'name' => $this->l('All shops'))), $shops);
     }
     $this->fields_form = array('legend' => array('title' => $this->l('Specific price rules')), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 33, 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop:'), 'name' => 'id_shop', 'options' => array('query' => $shops, 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency:'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group:'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity:'), 'name' => 'from_quantity', 'size' => 6, 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.):'), 'name' => 'price', 'size' => 6, 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'date', 'label' => $this->l('From:'), 'name' => 'from', 'size' => 12), array('type' => 'date', 'label' => $this->l('To:'), 'name' => 'to', 'size' => 12), array('type' => 'select', 'label' => $this->l('Reduction type:'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Reduction:'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
         $price = number_format($value, 2);
     } else {
         $price = '';
     }
     $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 2), 'leave_bprice_on' => $price ? 0 : 1);
     $attribute_groups = array();
     $attributes = Attribute::getAttributes((int) $this->context->language->id);
     foreach ($attributes as $attribute) {
         if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
             $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
         }
         $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
     }
     $features = Feature::getFeatures((int) $this->context->language->id);
     foreach ($features as &$feature) {
         $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
     }
     $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
     return parent::renderForm();
 }
开发者ID:rrameshsat,项目名称:Prestashop,代码行数:31,代码来源:AdminSpecificPriceRuleController.php

示例9: initFieldsetFeaturesDetachables

 public function initFieldsetFeaturesDetachables()
 {
     $this->fields_form[2]['form'] = array('legend' => array('title' => $this->l('Optional features'), 'icon' => 'icon-puzzle-piece'), 'description' => $this->l('Some features can be disabled in order to improve performance.'), 'input' => array(array('type' => 'hidden', 'name' => 'features_detachables_up'), array('type' => 'switch', 'label' => $this->l('Combinations'), 'name' => 'combination', 'is_bool' => true, 'disabled' => Combination::isCurrentlyUsed(), 'values' => array(array('id' => 'combination_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'combination_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Combinations.'), 'desc' => Combination::isCurrentlyUsed() ? $this->l('You cannot set this parameter to No when combinations are already used by some of your products') : null), array('type' => 'switch', 'label' => $this->l('Features'), 'name' => 'feature', 'is_bool' => true, 'values' => array(array('id' => 'feature_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'feature_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Product Features.')), array('type' => 'switch', 'label' => $this->l('Customer Groups'), 'name' => 'customer_group', 'is_bool' => true, 'disabled' => Group::isCurrentlyUsed(), 'values' => array(array('id' => 'group_1', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'group_0', 'value' => 0, 'label' => $this->l('No'))), 'hint' => $this->l('Choose "No" to disable Customer Groups.'))), 'submit' => array('title' => $this->l('Save')));
     $this->fields_value['combination'] = Combination::isFeatureActive();
     $this->fields_value['feature'] = Feature::isFeatureActive();
     $this->fields_value['customer_group'] = Group::isFeatureActive();
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:7,代码来源:AdminPerformanceController.php

示例10: ajaxProcessUpdatePositions

 public function ajaxProcessUpdatePositions()
 {
     if ($this->tabAccess['edit'] === '1') {
         $way = (int) Tools::getValue('way');
         $id = (int) Tools::getValue('id');
         $table = 'feature';
         $positions = Tools::getValue($table);
         if (empty($positions)) {
             $table = 'feature_value';
             $positions = Tools::getValue($table);
         }
         $new_positions = array();
         foreach ($positions as $v) {
             if (!empty($v)) {
                 $new_positions[] = $v;
             }
         }
         foreach ($new_positions as $position => $value) {
             $pos = explode('_', $value);
             if (isset($pos[2]) && (int) $pos[2] === $id) {
                 if ($table == 'feature') {
                     if ($feature = new Feature((int) $pos[2])) {
                         if (isset($position) && $feature->updatePosition($way, $position, $id)) {
                             echo 'ok position ' . (int) $position . ' for feature ' . (int) $pos[1] . '\\r\\n';
                         } else {
                             echo '{"hasError" : true, "errors" : "Can not update feature ' . (int) $id . ' to position ' . (int) $position . ' "}';
                         }
                     } else {
                         echo '{"hasError" : true, "errors" : "This feature (' . (int) $id . ') can t be loaded"}';
                     }
                     break;
                 } elseif ($table == 'feature_value') {
                     if ($feature_value = new FeatureValue((int) $pos[2])) {
                         if (isset($position) && $feature_value->updatePosition($way, $position, $id)) {
                             echo 'ok position ' . (int) $position . ' for feature value ' . (int) $pos[2] . '\\r\\n';
                         } else {
                             echo '{"hasError" : true, "errors" : "Can not update feature value ' . (int) $id . ' to position ' . (int) $position . ' "}';
                         }
                     } else {
                         echo '{"hasError" : true, "errors" : "This feature value (' . (int) $id . ') can t be loaded"}';
                     }
                     break;
                 }
             }
         }
     }
 }
开发者ID:hantonius,项目名称:advancedfeaturesvalues,代码行数:47,代码来源:AdminFeaturesController.php

示例11: toExtGeoJSON

 public function toExtGeoJSON()
 {
     $json_data = parent::toExtGeoJSON();
     if (isset($this->geometry)) {
         $json_data = array_merge($json_data, array('type' => 'Feature', 'geometry' => $this->geometry->toJSON()));
     }
     return $json_data;
 }
开发者ID:jtet,项目名称:php-libkml,代码行数:8,代码来源:Placemark.php

示例12: finalizeInstall

 public function finalizeInstall()
 {
     try {
         Feature::reregister('intercom', 'intercom', 'Intercom', 'Two-way intercom feature, dial feature number and extension', User::TYPE_SYSTEM_ADMIN);
     } catch (FeatureException $e) {
         if ($e->getCode() != 0 || $e->getCode() == -2) {
             throw $e;
         }
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:10,代码来源:configure.php

示例13: getValue

 public function getValue($source)
 {
     $value = '';
     if (array_key_exists('feature', $source)) {
         $values = Feature::where('id', '=', $source['feature']);
         if ($values->count()) {
             $value = $values->first()->feature;
         }
     }
     return $value;
 }
开发者ID:apetrailmukesh,项目名称:bootstrap,代码行数:11,代码来源:UtilityFeature.php

示例14: import

function import()
{
    try {
        $page = isset($_GET['page']) ? $_GET['page'] : null;
        if ($page == 0) {
            del_feature();
        }
        $results = get_writing($page);
        $size = sizeof($results);
        foreach ($results as $r) {
            $f = new Feature();
            $w = json_decode($r->writing);
            $char_id = $r->char_id;
            $features = $f->make_feature($w);
            //获取特征
            $dic = new Dictionary();
            $dict_feature = $dic->get_feature($char_id);
            //获取数据库中已存的特征值
            $dict_feature = isset($dict_feature) ? json_decode($dict_feature) : null;
            $t = new Trainer();
            $t->train($features, $dict_feature);
            $c = new Character();
            $first_stroke_type = $c->get_first_stroke_type($w);
            //首笔的笔画类型(横竖撇点折)
            $int_strokes = sizeof($w->s);
            //笔画数
            $dic->update_character($char_id, json_encode($t->train_features), $int_strokes, $first_stroke_type);
        }
        if ($size > 0) {
            echo "<meta HTTP-EQUIV=REFRESH CONTENT='5;URL=import.php?page=" . ($page + 1) . "'>";
        } else {
            echo "导入完成";
        }
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}
开发者ID:tianxang,项目名称:php-handwriting,代码行数:37,代码来源:import.php

示例15: getCMSFields

 public function getCMSFields()
 {
     $fields = new FieldList();
     $feature = $this->Feature();
     if ($feature->exists()) {
         $fields->push(ReadonlyField::create("FeatureTitle", "Feature", $feature->Title));
         $fields->push($feature->getValueField());
     } else {
         $selected = Feature::get()->innerJoin("ProductFeatureValue", "Feature.ID = ProductFeatureValue.FeatureID")->filter("ProductFeatureValue.ProductID", Controller::curr()->currentPageID())->getIDList();
         $features = Feature::get()->filter("ID:not", $selected);
         $fields->push(DropdownField::create("FeatureID", "Feature", $features->map()->toArray()));
         $fields->push(LiteralField::create("creationnote", "<p class=\"message\">You can choose a value for this feature after saving.</p>"));
     }
     return $fields;
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-comparison,代码行数:15,代码来源:ProductFeatureValue.php


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