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


PHP Options类代码示例

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


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

示例1: __construct

 public function __construct(Options $options)
 {
     $this->token = $options->get('token');
     if (empty($this->token)) {
         SS_Envato_API()->notices->add_warning('Please, set up your Envato API token.', true);
     }
 }
开发者ID:seriusokhatsky,项目名称:envato-api,代码行数:7,代码来源:class-api.php

示例2: initialize

 public static function initialize($idO, $idS, $new)
 {
     $OO = self::retrieveByPK($idO, $idS);
     if (!$OO instanceof Options) {
         $OO = new Options();
         $OO->setSiteId($idS);
     }
     return new OptionsForm($OO, array('IDS' => $idS, 'NEW' => $new));
 }
开发者ID:nagiro,项目名称:hospici_cultural,代码行数:9,代码来源:OptionsPeer.php

示例3: addAction

 public function addAction($question_id)
 {
     $this->view->poll = Questions::findFirst($question_id);
     if ($this->request->isPost()) {
         $option = new Options();
         $option->question_id = $question_id;
         $option->option_name = $this->request->getPost('name');
         $option->vote = 0;
         $option->save();
         return $this->dispatcher->forward(array('action' => 'show', 'params' => array($question_id)));
     }
 }
开发者ID:hymns,项目名称:PhalconTutorial,代码行数:12,代码来源:PollController.php

示例4: action_init

 /**
  * On plugin init
  **/
 public function action_init()
 {
     $this->class_name = strtolower(get_class($this));
     foreach (self::default_options() as $name => $value) {
         $this->config[$name] = Options::get($this->class_name . '__' . $name);
     }
 }
开发者ID:habari-extras,项目名称:geolocations,代码行数:10,代码来源:geolocations.plugin.php

示例5: __construct

 public function __construct()
 {
     $this->connection = @mysqli_connect(Options::get("mysql_host"), Options::get("mysql_user"), Options::get("mysql_password"), Options::get("mysql_db"));
     if (!$this->connection) {
         throw new Exception("Couldn't connect to database.", 1);
     }
 }
开发者ID:ortophius,项目名称:webm,代码行数:7,代码来源:dbadapter.php

示例6: __construct

 public function __construct(array $options = array(), Options $defaults = null)
 {
     $options = array_change_key_case($options, CASE_LOWER);
     if ($defaults) {
         $options += $defaults->get();
     }
     if (!empty($options['enable'])) {
         if (empty($options['plugins'])) {
             $options['plugins'] = $options['enable'];
         }
         unset($options['enable']);
     }
     foreach ($options + self::$standardOptions as $name => $value) {
         $this->__set($name, $value);
     }
 }
开发者ID:alexey-shapilov,项目名称:zorca-cms,代码行数:16,代码来源:Options.php

示例7: plot

 public static function plot()
 {
     $gnuscript = Options::getOption("harvester_gnu_script");
     if (Options::getOption("useGnuplot")) {
         system("gnuplot {$gnuscript}");
     }
 }
开发者ID:nsystem1,项目名称:ZeeJong,代码行数:7,代码来源:Statistics.php

示例8: requires_upgrade

	/**
	 * Determine if the database needs to be updated based on the source database version being newer than the schema last applied to the database
	 *
	 * @return boolean True if an update is needed
	 */
	public static function requires_upgrade()
	{
		if ( Options::get( 'db_version' ) < Version::DB_VERSION ) {
			return true;
		}
		return false;
	}
开发者ID:rynodivino,项目名称:system,代码行数:12,代码来源:version.php

示例9: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id = false)
 {
     if ($id === false) {
         $model = new Picture();
     } else {
         $model = $this->loadModel($id);
     }
     $msg = '';
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Picture'])) {
         $model->attributes = $_POST['Picture'];
         $path = Options::getOption('imgPath') . '/' . date('Y') . '/' . date('m') . '/' . date('his') . '-';
         $model->image = $path . CUploadedFile::getInstance($model, 'image');
         if ($model->save()) {
             $pathTo = $_SERVER['DOCUMENT_ROOT'] . $model->image;
         }
         $pathFrom = $_FILES['Picture']['tmp_name']['image'];
         Controller::createPathUploadsNow();
         if (!copy($pathFrom, $pathTo)) {
             $msg = '<p style="color: red; margin: 5px; border: 1px solid red; text-align: center">Файл не был записан.</p>';
         } else {
             chmod($pathTo, 0777);
             $msg = '<p style="color: green; margin: 5px; border: 1px solid green; text-align: center">Файл был записан.</p>';
         }
     }
     $this->render('create', array('model' => $model, 'msg' => $msg));
 }
开发者ID:alex-bro,项目名称:yiitest,代码行数:32,代码来源:PictureController.php

示例10: filter_default_rewrite_rules

 public function filter_default_rewrite_rules($rules)
 {
     if ($this->current_load() > self::KILL_LOAD) {
         foreach ($rules as $key => $rule) {
             if (strpos($rule['build_str'], 'admin') !== false) {
                 $rules[$key]['handler'] = 'UserThemeHandler';
                 $rules[$key]['action'] = 'display_throttle';
             }
         }
         if (Options::get('throttle') == '') {
             EventLog::log(sprintf(_t('Kill - Load is %s'), $this->current_load()));
             Options::set('throttle', 'kill');
         }
     } elseif ($this->current_load() > self::MAX_LOAD) {
         foreach ($rules as $key => $rule) {
             if ($rule['name'] == 'search') {
                 unset($rules[$key]);
             }
         }
         $rules[] = array('name' => 'search', 'parse_regex' => '%^search(?:/(?P<criteria>[^/]+))?(?:/page/(?P<page>\\d+))?/?$%i', 'build_str' => 'search(/{$criteria})(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_throttle', 'priority' => 8, 'description' => 'Searches posts');
         if (Options::get('throttle') == '') {
             EventLog::log(sprintf(_t('Restrict - Load is %s'), $this->current_load()));
             Options::set('throttle', 'restrict');
         }
     } else {
         if (Options::get('throttle') != '') {
             EventLog::log(sprintf(_t('Normal - Load is %s'), $this->current_load()));
             Options::set('throttle', '');
         }
     }
     return $rules;
 }
开发者ID:habari-extras,项目名称:throttle,代码行数:32,代码来源:throttle.plugin.php

示例11: extractPage

 public function extractPage($pageID, $pageTitle, $pageSource)
 {
     $this->extractor->setPageURI($pageID);
     if (!$this->extractor->isActive()) {
         return $result = new ExtractionResult($pageID, $this->extractor->getLanguage(), $this->getExtractorID());
     }
     Timer::start($this->extractor->getExtractorID());
     $result = $this->extractor->extractPage($pageID, $pageTitle, $pageSource);
     Timer::stop($this->extractor->getExtractorID());
     Timer::start('validation');
     //$this->extractor->check();
     if (Options::getOption('validateExtractors')) {
         ValidateExtractionResult::validate($result, $this->extractor);
     }
     Timer::stop('validation');
     Statistics::increaseCount($this->extractor->getExtractorID(), 'created_Triples', count($result->getTriples()));
     Statistics::increaseCount('Total', 'created_Triples', count($result->getTriples()));
     if ($this->extractor->isGenerateOWLAxiomAnnotations()) {
         $triples = $result->getTriples();
         if (count($triples) > 0) {
             foreach ($triples as $triple) {
                 $triple->addDCModifiedAnnotation();
                 $triple->addExtractedByAnnotation($this->extractor->getExtractorID());
             }
         }
     }
     return $result;
 }
开发者ID:nsystem1,项目名称:ZeeJong,代码行数:28,代码来源:ExtractorContainer.php

示例12: users_list_alm_users_user_photo_BeforeShow

function users_list_alm_users_user_photo_BeforeShow(&$sender)
{
    $users_list_alm_users_user_photo_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $users_list;
    //Compatibility
    //End users_list_alm_users_user_photo_BeforeShow
    //Custom Code @31-2A29BDB7
    // -------------------------
    // Write your own code here.
    $db = new clsDBdbConnection();
    $user_guid = $users_list->alm_users->guid->GetValue();
    $photo = trim(CCDLookup("photo", "alm_users", "guid = '{$user_guid}'", $db));
    //Default photo
    if (strlen($photo) <= 0) {
        $photo = "user128.png";
    }
    $options = Options::getConsoleOptions();
    $url = $options["console_internal_url"] . $options["console_users_url"] . $photo;
    $users_list->alm_users->user_photo->SetValue($url);
    $db->close();
    // -------------------------
    //End Custom Code
    //Close users_list_alm_users_user_photo_BeforeShow @30-EE399A43
    return $users_list_alm_users_user_photo_BeforeShow;
}
开发者ID:wangshipeng,项目名称:license_manager,代码行数:27,代码来源:users_list_events.php

示例13: action_post_update_before

 public function action_post_update_before($post)
 {
     $aliases = self::get_aliases();
     if (Options::get('tagrewriter__plurals') != NULL && Options::get('tagrewriter__plurals') == 1) {
         $pluralize = true;
     } else {
         $pluralize = false;
     }
     $tags = array();
     foreach ($post->tags as $tag) {
         if (isset($aliases[$tag])) {
             $tags[] = $aliases[$tag];
             continue;
         }
         if ($pluralize) {
             if (Tags::get_by_slug($tag . 's') != false) {
                 $tags[] = $tag . 's';
                 continue;
             } elseif (Tags::get_by_slug(rtrim($tag, 's')) != false) {
                 $tags[] = rtrim($tag, 's');
                 continue;
             }
         }
         $tags[] = $tag;
     }
     $post->tags = $tags;
 }
开发者ID:habari-extras,项目名称:tagrewriter,代码行数:27,代码来源:tagrewriter.plugin.php

示例14: action_comment_insert_after

    public function action_comment_insert_after($comment)
    {
        // we should only execute on comments, not pingbacks
        // and don't bother if the comment is know to be spam
        if ($comment->type != Comment::COMMENT || $comment->status == Comment::STATUS_SPAM) {
            return;
        }
        $post = Post::get(array('id' => $comment->post_id));
        $author = User::get_by_id($post->user_id);
        $status = $comment->status == Comment::STATUS_UNAPPROVED ? ' UNAPPROVED' : ' approved';
        $title = sprintf(_t('[%1$s] New%3$s comment on: %2$s'), Options::get('title'), $post->title, $status);
        $message = <<<MESSAGE
The following comment was added to the post "%1\$s".
%2\$s

Author: %3\$s <%4\$s>
URL: %5\$s

%6\$s

-----
Moderate comments: %7\$s
MESSAGE;
        $message = _t($message);
        $message = sprintf($message, $post->title, $post->permalink, $comment->name, $comment->email, $comment->url, $comment->content, URL::get('admin', 'page=comments'));
        $headers = array('MIME-Version: 1.0', 'Content-type: text/plain; charset=utf-8', 'Content-Transfer-Encoding: 8bit', 'From: ' . $this->mh_utf8($comment->name) . ' <' . $comment->email . '>');
        mail($author->email, $this->mh_utf8($title), $message, implode("\r\n", $headers));
    }
开发者ID:anupom,项目名称:my-blog,代码行数:28,代码来源:comment_notifier.plugin.php

示例15: go

 /**
  * Upload Proccess Function.
  * This will do the upload proccess. This function need some variables, eg: 
  * @param string $input This is the input field name.
  * @param string $path This is the path the file will be stored.
  * @param array $allowed This is the array of the allowed file extension.
  * @param false $uniq Set to true if want to use a unique name.
  * @param int $size File size maximum allowed.
  * @param int $width The width of the dimension.
  * @param int $height The height of the dimension.
  * 
  * @return array
  *
  * @author Puguh Wijayanto (www.metalgenix.com)
  * @since 0.0.1
  */
 public static function go($input, $path, $allowed = '', $uniq = false, $size = '', $width = '', $height = '')
 {
     $filename = Typo::cleanX($_FILES[$input]['name']);
     $filename = str_replace(' ', '_', $filename);
     if (isset($_FILES[$input]) && $_FILES[$input]['error'] == 0) {
         if ($uniq == true) {
             $site = Typo::slugify(Options::get('sitename'));
             $uniqfile = $site . '-' . sha1(microtime() . $filename) . '-';
         } else {
             $uniqfile = '';
         }
         $extension = pathinfo($_FILES[$input]['name'], PATHINFO_EXTENSION);
         $filetmp = $_FILES[$input]['tmp_name'];
         $filepath = GX_PATH . $path . $uniqfile . $filename;
         if (!in_array(strtolower($extension), $allowed)) {
             $result['error'] = 'File not allowed';
         } else {
             if (move_uploaded_file($filetmp, $filepath)) {
                 $result['filesize'] = filesize($filepath);
                 $result['filename'] = $uniqfile . $filename;
                 $result['path'] = $path . $uniqfile . $filename;
                 $result['filepath'] = $filepath;
                 $result['fileurl'] = Site::$url . $path . $uniqfile . $filename;
             } else {
                 $result['error'] = 'Cannot upload to directory, please check 
                 if directory is exist or You had permission to write it.';
             }
         }
     } else {
         //$result['error'] = $_FILES[$input]['error'];
         $result['error'] = '';
     }
     return $result;
 }
开发者ID:vdanelia,项目名称:GeniXCMS,代码行数:50,代码来源:Upload.class.php


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