Beispiel #1
0
 /**
  * Add contents in a cache file.
  * If the file doesn't exists attempt to create it.
  * 
  * @param string $fname
  * @param mixed $content
  * @return bool
  * @since 1.0.0
  */
 public function save($fname, $content)
 {
     $file = YIT_CACHE_DIR . '/' . $fname;
     return yit_file_put_contents($file, $content);
     //         $fp = fopen( $file, 'w' );
     //
     //         if( $fp !== false ) {
     //             fwrite( $fp, $content );
     //             fclose( $fp );
     //
     //             return true;
     //         }
     //
     //         return false;
 }
Beispiel #2
0
 /**
  * Add contents in a cache file.
  * If the file doesn't exists attempt to create it.
  * 
  * @param string $fname
  * @param mixed $content
  * @return bool
  * @since 1.0.0
  */
 public function save($fname, $content)
 {
     $file = $this->locate_file($fname);
     return yit_file_put_contents($file, $content);
     //         $fp = fopen( $file, 'w' );
     //
     //         if( $fp !== false ) {
     //             fwrite( $fp, $content );
     //             fclose( $fp );
     //
     //             return true;
     //         }
     //
     //         return false;
 }
Beispiel #3
0
 /**
  * Save the file with all css
  *
  * @return bool
  * @since 1.0.0
  */
 public function save_css()
 {
     global $wpdb;
     $css = array();
     // collect all css rules
     do_action('yit_save_css');
     foreach ($this->_rules as $rule => $args) {
         $args_css = array();
         foreach ($args as $arg => $value) {
             //if ( $value == '' ) continue;
             $args_css[] = $arg . ': ' . $value . ';';
         }
         $css[] = $rule . ' { ' . implode(' ', $args_css) . ' }';
     }
     $css = apply_filters('yit_custom_style', implode("\n", $css));
     // save the css in the file
     $index = $wpdb->blogid != 0 ? '-' . $wpdb->blogid : '';
     yit_file_put_contents(YIT_CACHE_DIR . '/' . str_replace('.css', $index . '.css', $this->_customFilename), $css);
 }
Beispiel #4
0
 /**
  * Add contents in a cache file.
  * If the file doesn't exists attempt to create it.
  * 
  * @param string $fname The file name to locate or create.
  * @param mixed $content The filecontent.
  * @return mixed
  * @since 1.0.0
  * @author Simone D'Amico <*****@*****.**>
  */
 public function save($fname, $content)
 {
     $file = $this->locate_file($fname);
     return yit_file_put_contents($file, $content);
 }