/**
  * Returns an input field.
  *
  * @param string $name
  * @param null|string $title
  * @param string $value
  */
 public function __construct($name, $title = null, $value = '')
 {
     if (count(func_get_args()) > 3) {
         Deprecation::notice('3.0', 'Use setMaxLength() instead of constructor arguments', Deprecation::SCOPE_GLOBAL);
     }
     parent::__construct($name, $title, $value);
 }
 /**
  * @return string
  */
 public function InternallyLabelledField()
 {
     Deprecation::notice('4.0', 'Please use ->setValue() instead');
     if (!$this->value) {
         $this->value = $this->Title();
     }
     return $this->Field();
 }
 /**
  * @deprecated 4.0 Use the "Security.login_recording" config setting instead
  * @return boolean
  */
 public static function login_recording()
 {
     Deprecation::notice('4.0', 'Use the "Security.login_recording" config setting instead');
     return self::$login_recording;
 }
 /**
  * Cleanup function to reset all the Filename fields.  Visit File/fixfiles to call.
  *
  * @deprecated 5.0
  */
 public function fixfiles()
 {
     Deprecation::notice('5.0');
     if (!Permission::check('ADMIN')) {
         return Security::permissionFailure($this);
     }
     $files = File::get();
     foreach ($files as $file) {
         $file->updateFilesystem();
         echo "<li>", $file->Filename;
         $file->write();
     }
     echo "<p>Done!";
 }
 /**
  * Returns true if a class or interface name exists in the manifest.
  *
  * @param  string $class
  * @return bool
  */
 public function classExists($class)
 {
     Deprecation::notice('4.0', 'Use ClassInfo::exists.');
     return ClassInfo::exists($class);
 }
 /**
  * Set the environment type of the current site.
  *
  * Typically, a SilverStripe site have a number of environments:
  *  - Development environments, such a copy on your local machine.
  *  - Test sites, such as the one you show the client before going live.
  *  - The live site itself.
  *
  * The behaviour of these environments often varies slightly.  For example, development sites may
  * have errors dumped to the screen, and order confirmation emails might be sent to the developer
  * instead of the client.
  *
  * To help with this, SilverStripe supports the notion of an environment type.  The environment
  * type can be dev, test, or live.
  *
  * You can set it explicitly with {@link Director::set_environment_type()}. Or you can use
  * {@link Director::$dev_servers} and {@link Director::$test_servers} to set it implicitly, based
  * on the value of $_SERVER['HTTP_HOST'].  If the HTTP_HOST value is one of the servers listed,
  * then the environment type will be test or dev.  Otherwise, the environment type will be live.
  *
  * Dev mode can also be forced by putting ?isDev=1 in your URL, which will ask you to log in and
  * then push the site into dev mode for the remainder of the session. Putting ?isDev=0 onto the URL
  * can turn it back.
  *
  * Test mode can also be forced by putting ?isTest=1 in your URL, which will ask you to log in and
  * then push the site into test mode for the remainder of the session. Putting ?isTest=0 onto the URL
  * can turn it back.
  *
  * Generally speaking, these methods will be called from your _config.php file.
  *
  * Once the environment type is set, it can be checked with {@link Director::isDev()},
  * {@link Director::isTest()}, and {@link Director::isLive()}.
  *
  * @deprecated 4.0 Use the "Director.environment_type" config setting instead
  *
  * @param $et string
  */
 public static function set_environment_type($et)
 {
     if ($et != 'dev' && $et != 'test' && $et != 'live') {
         user_error("Director::set_environment_type passed '{$et}'.  It should be passed dev, test, or live", E_USER_WARNING);
     } else {
         Deprecation::notice('4.0', 'Use the "Director.environment_type" config setting instead');
         Config::inst()->update('SilverStripe\\Control\\Director', 'environment_type', $et);
     }
 }
 /**
  * Get a array of allowed actions defined on this controller,
  * any parent classes or extensions.
  *
  * Caution: Since 3.1, allowed_actions definitions only apply
  * to methods on the controller they're defined on,
  * so it is recommended to use the $class argument
  * when invoking this method.
  *
  * @param string $limitToClass
  * @return array|null
  */
 public function allowedActions($limitToClass = null)
 {
     if ($limitToClass) {
         $actions = Config::inst()->get($limitToClass, 'allowed_actions', Config::UNINHERITED | Config::EXCLUDE_EXTRA_SOURCES);
     } else {
         $actions = Config::inst()->get(get_class($this), 'allowed_actions');
     }
     if (is_array($actions)) {
         if (array_key_exists('*', $actions)) {
             Deprecation::notice('3.0', 'Wildcards (*) are no longer valid in $allowed_actions due their ambiguous ' . ' and potentially insecure behaviour. Please define all methods explicitly instead.');
         }
         // convert all keys and values to lowercase to
         // allow for easier comparison, unless it is a permission code
         $actions = array_change_key_case($actions, CASE_LOWER);
         foreach ($actions as $key => $value) {
             if (is_numeric($key)) {
                 $actions[$key] = strtolower($value);
             }
         }
         return $actions;
     } else {
         return null;
     }
 }
 /**
  * @deprecated 4.0..5.0
  */
 public static function table_for_object_field($candidateClass, $fieldName)
 {
     Deprecation::notice('5.0', 'Use DataObject::getSchema()->tableForField()');
     return DataObject::getSchema()->tableForField($candidateClass, $fieldName);
 }
 /**
  * @deprecated 4.0 Use FormField::create_tag()
  *
  * @param string $tag
  * @param array $attributes
  * @param null|string $content
  *
  * @return string
  */
 public function createTag($tag, $attributes, $content = null)
 {
     Deprecation::notice('4.0', 'Use FormField::create_tag()');
     return self::create_tag($tag, $attributes, $content);
 }
 /**
  * Public accessor for {@see DataObject::validate()}
  *
  * @return ValidationResult
  */
 public function doValidate()
 {
     Deprecation::notice('5.0', 'Use validate');
     return $this->validate();
 }
 /**
  * @deprecated 4.0..5.0
  */
 public function publish($fromStage, $toStage, $createNewVersion = false)
 {
     Deprecation::notice('5.0', 'Use copyVersionToStage instead');
     $this->owner->copyVersionToStage($fromStage, $toStage, $createNewVersion);
 }
 /**
  * Clear all data out of the database
  *
  * @deprecated since version 4.0
  */
 public function clearAllData()
 {
     Deprecation::notice('4.0', 'Use DB::get_conn()->clearAllData() instead');
     DB::get_conn()->clearAllData();
 }
 protected function callThatOriginatesFromFramework()
 {
     $this->assertEquals(DeprecationTest_Deprecation::get_module(), basename(FRAMEWORK_PATH));
     $this->assertNull(Deprecation::notice('2.0', 'Deprecation test passed'));
 }
Example #14
0
 /**
  * @deprecated since version 4.0 Use DB::get_conn instead
  * @todo PSR-2 standardisation will probably un-deprecate this
  */
 public static function getConn($name = 'default')
 {
     Deprecation::notice('4.0', 'Use DB::get_conn instead');
     return self::get_conn($name);
 }
 /**
  * @deprecated 4.0.0:5.0.0 Use renderVariable() instead
  */
 public function writeVariable($val, $caller)
 {
     Deprecation::notice('4.0', 'Use renderVariable() instead');
     echo $this->renderVariable($val, $caller);
 }
 /**
  * Dispatch a message by priority level.
  *
  * The message parameter can be either a string (a simple error
  * message), or an array of variables. The latter is useful for passing
  * along a list of debug information for the writer to handle, such as
  * error code, error line, error context (backtrace).
  *
  * @param mixed $message Exception object or array of error context variables
  * @param string $priority Priority. Possible values: Log::ERR, Log::WARN, Log::NOTICE, Log::INFO or Log::DEBUG
  *
  * @deprecated 4.0.0:5.0.0 Use Injector::inst()->get('Logger')->log($priority, $message) instead
  */
 public static function log($message, $priority)
 {
     Deprecation::notice('5.0', 'Use Injector::inst()->get(\'Logger\')->log($priority, $message) instead');
     Injector::inst()->get('Logger')->log($priority, $message);
 }
 /**
  * Create a new email.
  *
  * @param string|null $from
  * @param string|null $to
  * @param string|null $subject
  * @param string|null $body
  * @param string|null $bounceHandlerURL
  * @param string|null $cc
  * @param string|null $bcc
  */
 public function __construct($from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
 {
     if ($from !== null) {
         $this->from = $from;
     }
     if ($to !== null) {
         $this->to = $to;
     }
     if ($subject !== null) {
         $this->subject = $subject;
     }
     if ($body !== null) {
         $this->body = $body;
     }
     if ($cc !== null) {
         $this->cc = $cc;
     }
     if ($bcc !== null) {
         $this->bcc = $bcc;
     }
     if ($bounceHandlerURL !== null) {
         Deprecation::notice('4.0', 'Use "emailbouncehandler" module');
     }
     parent::__construct();
 }
 /**
  * @deprecated 5.0
  */
 public static function menu_title_for_class($class)
 {
     Deprecation::notice('5.0', 'Use menu_title() instead');
     return static::menu_title($class, false);
 }
    /**
     * Retrieves the finalised list of joins
     *
     * @todo This part of the code could be simplified
     *
     * @param array $parameters Out variable for parameters required for this query
     * @return array List of joins as a mapping from array('Alias' => 'Join Expression')
     */
    public function getJoins(&$parameters = array())
    {
        if (func_num_args() == 0) {
            Deprecation::notice('4.0', 'SQLConditionalExpression::getJoins() now may produce parameters which are necessary to
				execute this query');
        }
        // Sort the joins
        $parameters = array();
        $joins = $this->getOrderedJoins($this->from);
        // Build from clauses
        foreach ($joins as $alias => $join) {
            // $join can be something like this array structure
            // array('type' => 'inner', 'table' => 'SiteTree', 'filter' => array("SiteTree.ID = 1",
            // "Status = 'approved'", 'order' => 20))
            if (!is_array($join)) {
                continue;
            }
            if (is_string($join['filter'])) {
                $filter = $join['filter'];
            } elseif (sizeof($join['filter']) == 1) {
                $filter = $join['filter'][0];
            } else {
                $filter = "(" . implode(") AND (", $join['filter']) . ")";
            }
            // Ensure tables are quoted, unless the table is actually a sub-select
            $table = preg_match('/\\bSELECT\\b/i', $join['table']) ? $join['table'] : "\"{$join['table']}\"";
            $aliasClause = $alias != $join['table'] ? " AS \"{$alias}\"" : "";
            $joins[$alias] = strtoupper($join['type']) . " JOIN " . $table . "{$aliasClause} ON {$filter}";
            if (!empty($join['parameters'])) {
                $parameters = array_merge($parameters, $join['parameters']);
            }
        }
        return $joins;
    }
 /**
  * Returns an HTML rendition of this form, without the <form> tag itself.
  *
  * Attaches 3 extra hidden files, _form_action, _form_name, _form_method,
  * and _form_enctype.  These are the attributes of the form.  These fields
  * can be used to send the form to Ajax.
  *
  * @deprecated 5.0
  * @return string
  */
 public function formHtmlContent()
 {
     Deprecation::notice('5.0');
     $this->IncludeFormTag = false;
     $content = $this->forTemplate();
     $this->IncludeFormTag = true;
     $content .= "<input type=\"hidden\" name=\"_form_action\" id=\"" . $this->FormName . "_form_action\"" . " value=\"" . $this->FormAction() . "\" />\n";
     $content .= "<input type=\"hidden\" name=\"_form_name\" value=\"" . $this->FormName() . "\" />\n";
     $content .= "<input type=\"hidden\" name=\"_form_method\" value=\"" . $this->FormMethod() . "\" />\n";
     $content .= "<input type=\"hidden\" name=\"_form_enctype\" value=\"" . $this->getEncType() . "\" />\n";
     return $content;
 }
 /**
  * @deprecated 4.0 Use the "Session.timeout" config setting instead
  */
 public static function get_timeout()
 {
     Deprecation::notice('4.0', 'Use the "Session.timeout" config setting instead');
     return Config::inst()->get('SilverStripe\\Control\\Session', 'timeout');
 }
 /**
  * @deprecated 4.0 Use the "SSViewer.rewrite_hash_links" config setting instead
  * @param string
  * @return mixed
  */
 public static function getOption($optionName)
 {
     if ($optionName == 'rewriteHashlinks') {
         Deprecation::notice('4.0', 'Use the "SSViewer.rewrite_hash_links" config setting instead');
         return SSViewer::config()->get('rewrite_hash_links');
     } else {
         Deprecation::notice('4.0', 'Use the "SSViewer.' . $optionName . '" config setting instead');
         return SSViewer::config()->get($optionName);
     }
 }
 /**
  * Update the given HTML content with the appropriate include tags for the registered
  * requirements. Needs to receive a valid HTML/XHTML template in the $content parameter,
  * including a head and body tag.
  *
  * @param string $content      HTML content that has already been parsed from the $templateFile
  *                             through {@link SSViewer}
  * @return string HTML content augmented with the requirements tags
  */
 public static function includeInHTML($content)
 {
     if (func_num_args() > 1) {
         Deprecation::notice('5.0', '$templateFile argument is deprecated. includeInHTML takes a sole $content parameter now.');
         $content = func_get_arg(1);
     }
     return self::backend()->includeInHTML($content);
 }