<?php use CCK\ContentAPI; use CCK\FieldsUI; # Create FieldsUI Object $fieldsUI = new FieldsUI($_cck_types, $_cck_config); # New ContentAPI Object $_cck_api_content = new ContentAPI($_cck_types, $_cck_config); # Check for ID if (isset($_GET['ID']) && is_numeric($_GET['ID'])) { # Get Content $content = $_cck_api_content->get($_GET, 'Array'); # If not false, pass to UI. if ($content) { # The Content $theContent = $content[0]; # Get Type if (!$fieldsUI->typeExists($theContent['type'])) { add_var('error', '<strong>' . $theContent['type'] . '</strong> is not a valid content type.'); } else { # Type $type = $theContent['type']; # Pass to UI add_var('fields', $fieldsUI->buildForm($type, $theContent)); add_var('type', $type); } } } else { header('location: /manage'); }
echo "<td>"; if (isset($allvars['MEMBER']) && is_array($allvars['MEMBER'])) { foreach ($allvars['MEMBER'] as $ttk => $ttv) { if (isset($ttv[$var]) && is_array($ttv[$var])) { echo sprintf(_("Overwritted by %s"), $members[$ttk]['login']) . " → "; echo "<a href='javascript:edit_var(" . $ttv[$var]['id'] . ");'>"; $variables->display_valueraw_html($ttv[$var]['value'], $var); echo "</a>"; edit_var($ttv[$var]); } echo "<br/>"; } } //isset echo "<a href='javascript:add_var(\"{$strata}\");'>" . _("Add") . "</a>"; add_var($strata, $members_list); echo "</td>"; break; case 'DOMAIN': //FIXME TODO echo "<td>Todo.</td>"; break; } //switch echo "</tr>"; } //foreach echo "</table>"; ?> <p><span class="ina back"><a href="adm_variables.php"><?php
// "Translate('...'),Translate('...')" if (preg_match_all('/Translate(W|WideW|AnsiW|String|WideString)?\\s*\\(\'(.*)\'\\)/i', $line, $matches)) { foreach ($matches[2] as $match) { add_str($match, $i); } } else { // capture Translate(var) if (preg_match_all('/Translate(W|WideW|AnsiW|String|WideString)?\\s*\\((.*)\\)/i', $line, $matches)) { foreach ($matches[2] as $match) { add_prop($match, $i); } } } $pattern = "/([\\w\\d]+)\\s*\\:\\s*[\\w\\d]+\\s*\\=\\s*\\'(.*)\\';\$/is"; if (preg_match($pattern, $line, $matches)) { add_var($matches[1], $matches[2], $line); } } } // delete properties which are actually vars foreach ($pas_var as $i => $var) { $found = false; $var = strtolower($var); foreach ($pas_prop as $n => $prop) { $prop = strtolower($prop); if ($var == $prop) { unset($pas_prop[$n]); unset($pas_prop_line[$n]); $found = true; break; }
<?php use Theme\Variables; /** * Variables Object */ $variables = new Variables($_config); # Include Variable Functions require __DIR__ . '/functions/variables.php'; # Debug helpers add_var('dev', array('localhost' => is_localhost())); # Page variables add_var('page', array('is_home' => is_home(), 'path' => $path, 'slug' => get_page()), true); # User variables add_var('user', array('is_loggedin' => is_loggedin())); # Various useful variables add_var('this_year', this_year());
<?php use CCK\ContentAPI; # New ContentAPI Object $_cck_api_content = new ContentAPI($_cck_types, $_cck_config); # Get Args $args = count($_GET) > 1 ? $_GET : array('status' => array(0, 1)); # Get Content $content = $_cck_api_content->get($args, 'Array'); # Pass to UI add_var('cck_content', $content);
$_cck_config = plugin_load_config('cck'); # Check Medoo class exists if (!class_exists('medoo')) { throw new Exception('Medoo is required for CCK'); } # Load Content Types $_cck_types = cck_get_content_types(); # Load Classes & Functions require_once __DIR__ . '/lib.php'; # Create Database Instance if (isset($db) && $db instanceof medoo) { $_cck_config['db'] = $db; } else { $_cck_config['db'] = new medoo(array('database_type' => 'mysql', 'database_name' => 'cck_db', 'server' => '127.0.0.1', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'prefix' => 'cck_')); } # Define custom controller # and theme directories. if (in_array($path, $_cck_config['paths'])) { # Set Controller $controller->useController(__DIR__ . '/controller'); # Set Theme $theme->useTheme(__DIR__ . '/theme'); # Create Theme Assets add_var('cck', apply_filters('cck_assets', $_cck_config['assets'])); # Create Variable for Post Types add_var('cck_post_types', $_cck_types); } # Get Content for current path # if there is any and assign it # to the page.content variable. extend_var('page', 'content', get_content());
<?php use CCK\Media; $media = new Media($_cck_config); # Get Media add_var('media_library', $media->get($_GET));